My title sums up my question. I have an Android App written entirely with html5 and javascript. I am a beginner at java (at best) and do not want to use java to do this, but, instead, javascript. I want to be able to turn off video and music when a phone call comes in or the application otherwise goes to the background. I have tried window.onBlur and the new html5 visibility API. No dice. Is there a way to do this without rolling up my sleeves and learning Java? I want to use javascript.
Register for the "pause" event. When your app has been paused generally it means you've been put in the background. When you get paused stop playing the audio.
http://docs.phonegap.com/en/2.2.0/cordova_events_events.md.html#pause
Then register for a resume event and start up things again:
http://docs.phonegap.com/en/2.2.0/cordova_events_events.md.html#resume
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With