question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android plugin @Override onActivityResult never gets called/invoked.

See original GitHub issue

This seems really similar to a previous issue #898

The facebook plugin https://github.com/Telerik-Verified-Plugins/Facebook is passing the current activity via cordova.getActivity() to facebook android sdk. In turn the facebook sdk is supposed to be calling the onActivityResult method on the Plugin, but it never fires.

ConnectPlugin.java line 260

@Override
    public void onActivityResult(int requestCode, int resultCode, Intent intent) {
        Log.d("Never makes it here :(");
        super.onActivityResult(requestCode, resultCode, intent);
        Log.d(TAG, "activity result in plugin: requestCode(" + requestCode + "), resultCode(" + resultCode + ")");
        callbackManager.onActivityResult(requestCode, resultCode, intent);
    }

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mpostcommented, Jul 25, 2016

Current if you call startActivityForResult(CordovaPlugin, ..) this plugin will be the receiver of the returned value. The setActivityResultCallback will not be honored.

To broaden the cordova support though it makes sense to allow this alternative method as well and we will update the tabris-android platform accordingly. This change will be in after the 1.9 release though.

0reactions
mpostcommented, Aug 18, 2016

@exocom @dested We have updated the cordova integration to properly dispatch the activity result to the plugin. Please try with the latest nightly build. This also required to updated to the latest cordova-android platform 5.2.2 which in turn requires the latest cordova-cli 6.3.1.

We have actually used the cordova-plugin-health plugin to sign in with the google api client and to retrieve the current step count. The turn around worked as expected. Thanks @dested for the hint.

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - onActivityResult never called - Stack Overflow
I tried putting the onActivityResult function in my FriendPicker class and lo log either. I don't get it... – thomaus. Mar 14, 2011...
Read more >
Getting a result from an activity - Android Developers
Note: Since your process and activity can be destroyed between when you call launch() and when the onActivityResult() callback is triggered, any ...
Read more >
[Android] Add super method calls to onActivityResult overrides ...
In this case flows that involve doSomething won't work, because results from startActivityForResult will never get to super.onActivityResult.
Read more >
Some questions about onActivityResult and ... - Unity Forum
Hello Folks, Just started some android plugin tests. i have a ... is never called.. ?? the static function is working (i get...
Read more >
Unity Android Plugins and `onActivityResult` callback - Medium
I quickly gave up this approach as only one plugin can override Unity activity and people sometimes use multiple Android plugins.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found