darryncampbell / darryncampbell-cordova-plugin-intent

General purpose intent shim layer for cordova appliations on Android. Handles various techniques for sending and receiving intents.
MIT License
86 stars 134 forks source link

onActivityResult can be called before the onActivityResultCallbackContext is set #74

Closed robbterr closed 5 years ago

robbterr commented 5 years ago

Hi, super plugin, but i have a little problem :)

i couldn´t get the startActivityForResult function to work reliably.

Because the caller app sometimes gets cancalled while i am in the called app, if that happens i don´t get the result.

if the app gets cancelled, the caller app starts again with the result as intent and the "onActivityResult" handler gets triggert, but shortly after startup there is no "onActivityResultCallbackContext" defined, so the intent gets lost

so we need to store the intent and return it later, when the "onActivityResultCallbackContext" gets set with "onActivityResult"

its already done for the onIntent/getIntent and the onNewIntent handler with the "deferredIntent"

Does this sound right? Or do i have another problem?

br Robert

darryncampbell commented 5 years ago

Hi, yes, that sounds like it is the issue, you would need to define a separate deferred Intent.

darryncampbell commented 5 years ago

Hi, I'm just trying to understand this a bit more... So Application A calls StartActivityForResult() which starts Application B, then Application A gets cancelled by the user, after which Application B tries to return a result but is unable to do so because the original Application A has disappeared?

darryncampbell commented 5 years ago

Closed due to lack of activity