我从下面的链接为我的cordova应用程序实现了以下解决方案,它在android上有效,但在ios平台上不起作用 onPause和onResume事件在ios上不起作用。
how to check app running in foreground or background in ionic/cordova/phonegap
答案 0 :(得分:0)
我相信API已更新为暂停和恢复
document.addEventListener("pause", onPause, false);
document.addEventListener("resume", onResume, false);
不带代码就很难告诉我们
在此处检查文档:https://cordova.apache.org/docs/en/9.x/cordova/events/events.html#page-toc-source