问题
Mine is a Cordova based hybrid app. Inside our activity(say A), there is a button which when clicked launches another activity, say B. B is actually inside a cordova plugin. So of course we use javascript to initiate B.
So when B is running, A wants to know the last active timestamp. A triggers a javascript call(since B is inside a plugin) to get the last active stamp every 1 minute.
In devices below Oreo, everything works fine. In devices with Oreo, the javascript call gets blocked after 5 minutes of B getting in foreground. No further javascript calls get executed.
If I kill B and return to A, this call gets executed.
I know this happens because of new background execution limits in Oreo.
How can I make sure that javascript calls are executed from A when B is foreground in Oreo devices? What are the options I have?
来源:https://stackoverflow.com/questions/55136177/background-execution-in-oreo-android-devices