[
https://issues.apache.org/jira/browse/CB-10498?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15130819#comment-15130819
]
Richard B Knoll commented on CB-10498:
--------------------------------------
I have a fix for this. It changes the behavior of the resume event to be as
follows:
1. When the app starts and there is no plugin result to be delivered, the
*resume event will not fire* (same as current behavior)
2. When the app is left and then resumed (e.g. press the home button and then
return to the app), the *resume event will fire but will not be sticky* (same
as current behavior)
3. When the app is recreated after a plugin Activity finishes (i.e. the event
payload contains a pending result), the *resume event will fire and will be
sticky*
In the third scenario, subscribing to the resume event after it has been fired
in the webview will cause the event listener to be immediately called with the
resume event and the pending result. This should let you subscribe to the event
whenever you want. I believe the behavior recommended by our docs is to do so
as part of the deviceready event, so I will probably need to update my sample
application in the Android lifecycle docs so that it actually does this.
Subscribing at that point should be enough to make sure you don't miss any
resume events from scenarios two and three.
You should only subscribe to the resume event once, because once the event is
"stuck" by the third scenario it will keep being delivered whenever you add an
event listener.
> Resume event not guaranteed to be received with plugin result
> -------------------------------------------------------------
>
> Key: CB-10498
> URL: https://issues.apache.org/jira/browse/CB-10498
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Reporter: Richard B Knoll
> Assignee: Richard B Knoll
> Labels: android, triaged
>
> The save/restore API delivers results in the resume event. The issue is, it
> is possible to "miss" the resume event if you don't add an event handler in
> time.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]