Martin Harvey
Martin Harvey

Reputation: 2008

CodenameOne IntentResultListener not being called

I have been trying to call an oAuth evernote library without success. The authentication works but my Codename One app is not notified via the startActivityForResult() mechanism. I have trimmed out as many factors as I can. I have currently reduced it to startActivityForResult() using the Contact application.

I now have a Codename One native class with the following code. (This is an example from https://developer.android.com/guide/components/intents-common.html).

private void selectContact() {

    debugOut ("selectContact: Entry");

    Intent intent = new Intent(Intent.ACTION_PICK);
    intent.setType(ContactsContract.Contacts.CONTENT_TYPE);

    AndroidNativeUtil.startActivityForResult(intent, new IntentResultListener() {
        public void onActivityResult (int requestCode, int resultCode, Intent data) {
            debugOut ("onActivityResult: Entry");
        }
    });

    debugOut ("selectContact: Exit");
}

A call to selectContact() launches the Contact application. When I pick a Contact, the Contact application closes. The system console shows both messages: "selectContact: Entry" and "selectContact: Exit".

The code in IntentResultListener.onActivityResult() is not called (ie ""onActivityResult: Entry" is not output).

I have tried to look at the Codename One source on GitHub (CodenameOneActivity.java), in particular this:

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    //is this a payment result
    if (mHelper != null && mHelper.handleActivityResult(requestCode, resultCode, data)) {
        return;
    }
    IntentResult response = new IntentResult(requestCode, resultCode, data);
    intentResult.add(response);
}

I'm likely looking in the wrong place but this does not appear to forward received Intents if it is not interested. (I am making an assumption that the cloud build uses CodenameOneActivity to build the Android app).

Upvotes: 1

Views: 70

Answers (1)

Shai Almog
Shai Almog

Reputation: 52770

I think this effectively broke that functionality. I've filed an issue to track this.

Upvotes: 1

Related Questions