- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Im making a one app to play audio streaming with html5.
All works fine, play in background, etc.
But on Android 6.0 Marshmallow he reload if minimized, see: https://drive.google.com/open?id=0B7_KN57XiL-xLU5kaEF1c1dTT0k
On others versions of android works like a charm, i think is some permission. Anyone have idea to solve this?
Already tried some plugins ( Native audio, Media, cordova plugin background audio, Ktzer background mode ) :(
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What are you setting the "Target Android API" level to? Set it to 21 and build with Crosswalk (any version) to see if you get the same results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Paul, thank you for reply.
Same problem, still have problem on Android 6.0 Marshmallow =(
Any idea?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Eberton -- since you get the same results whether you use Crosswalk or the native webview, it must be something to do with Android 6. As you indicated earlier, it might be a permissions issue, but setting the target API level to 21 generally takes care of that problem, because it effectively tells the Android runtime that you are not yet compatible with the new permissions APIs that level 23 introduced.
Probably what's happening is Android 6 is being more aggressive about power saving and is forcing your app to "quit." Which then results in a "resume" from a cold state. I would add some code to capture entry into the pause and resume states and write some data out to see if that's what's happening (for example to console.log). You'll have to do this debugging with a built app for an accurate representation of what's going on (see https://software.intel.com/en-us/xdk/docs/intel-xdk-debug-and-test-overview#RemoteChromeDevTools). It's quite possible remote CDT could interfere with these events, in which case you may need to write some info to an on-device file (using the cordova file plugin API, write to a file in the "external SDCard" folders) and then retrieve that information after the fact.
Here are some links that will help with the pause/resume events:
- http://www.telerik.com/blogs/phonegap-apache-cordova-lifecycle-events
- http://cordova.apache.org/docs/en/6.x/cordova/events/events.html
- http://cordova.apache.org/docs/en/5.1.1/cordova/events/events.html
Note that there are several other Android lifecycle events, as briefly described by this SO post:
Additional FYI:
- https://github.com/agamemnus/cordova-plugin-ondestroy
- https://cordova.apache.org/docs/en/latest/guide/platforms/android/plugin.html#plugin-initialization-and-lifetime
- https://github.com/apache/cordova-js/blob/81d8b9924b78804017fbce2ee7bd3f92560d341a/src/common/channel.js#L25
Especially, the "onPause" and the "window.onunload" events may be useful to track for help in debugging this issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Paul, I think I could understand what is going on.
Is this some method to prevent the pause event?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You cannot stop a pause event from within a webview, the Android OS uses that to manage device battery consumption. It can be done using special plugins, so you might have to investigate finding some plugins that allow your app to continue running in the background. A better solution would be a plugin that explictly allows a specific function to run in the background, an then the rest of your app needs to monitor the "resume" event so you can restore the rest of your app to the appropriate state, avoiding the "reset" that appears to be taking place.
It could also be that there's a "task manager" running on your Android 6, test device that's causing this to happen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Solved! Thank you so much Paul, you saved my life. :D
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What was the solution? Please share so it can help others with the same symptoms.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Eberton M. wrote:
Solved! Thank you so much Paul, you saved my life. :D
Hi! Can you please share with us your solution ?
Thank you !

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page