I am developing an ios app in monaca.
The application seems to be running in the background even when I press the home button.
If you go back to the app, you will be returned to the screen of the game that was in progress and the background music will be resend.
To exit the app without going around the background after pressing the Home button, click
What should I do?
For xcode, if you set UIAapplicationExitsOnSuspend to Info.plist,
I think I can close the app, but I don't know what to do with monaca.
Note: http://d.hatena.ne.jp/paraches/20100715
I tried writing the process using Cordova pause resume, but it didn't work.
Cordova Event Handling http://docs.monaca.mobi/cur/ja/reference/phonegap_34/ja/events/events/ #backbutton
I would appreciate it if you could tell me how to solve this problem.
Thank you for your cooperation.
The following is a list of methods that did not work with ios, but only with Android.
// Pressing the home button stops the background music and resends it when you go back to the app
document.addEventListener("pause", function() {audio.pause();}, false);
document.addEventListener("resume", function() {audio.play();}, false);
// Press the Home button to exit the app without going to the background
document.addEventListener("pause", onPause, false);
function onPause() {
navigator.app.exitApp();
}
// Press the back button to exit the app without going around the background
document.addEventListener("backbutton", function(e){
e.preventDefault();
navigator.app.exitApp();
}, false);
For ios, programmed application shutdown may be subject to rejection.Instead of shutting down the app, you should stop playing games and background music.
http://ushisantoasobu.hateblo.jp/entry/2013/02/17/185403
Monaca and Cordova don't seem to offer an API to close the app on iOS, so I think you need to write the Cordova plug-in yourself.
© 2024 OneMinuteCode. All rights reserved.