![](/img/trans.png)
[英]Ionic Cordova Detect app kill event when app is killed by swiping it from the recent app list
[英]How to handle code when app in ionic is killed by swiping from recent activity bar
我在ionic v1中使用了混合应用程序,该应用程序具有登录功能,并且将用户数据存储在jstorage中,即用户ID和密码,但是每当用户从Android中最近的活动栏中滑动该应用程序时,它始终保持在相同的视图上在终止该应用程序之前。 我要在滑动或杀死应用程序时注销用户
您可以收听暂停或继续的事件并注销其中之一。
document.addEventListener("pause", onPause, false); function onPause() { // Handle the pause event }
要么
document.addEventListener("resume", onResume, false); function onResume() { // Handle the resume event }
当我使用以下代码时,正在尝试一些方法注销用户,并且对我有用。
document.addEventListener("destory", function destoryCallback(){
apiService.logout().then(function (callback){
if(callback.data.data)
{
}
else{
}
}).catch(function (reason) {
// catch the reason for the failier of api
})
}, false);
并在准备好的设备中编写此侦听器
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.