如何当离子的应用程序是通过从最近的活动吧刷卡杀害处理代码

问题描述 投票:0回答:2

我提出使用在离子V1的混合应用中,我已登录的功能,我存储在jstorage即用户ID和口令,但每当用户刷从Android中的近期活动栏中的应用程序,它仍保持在同一视图中的用户数据它是杀死应用之前。我想,当我刷卡注销用户或终止该应用

android cordova ionic-framework hybrid-mobile-app
2个回答
0
投票

你可以听暂停或恢复events和注销的其中之一。

document.addEventListener("pause", onPause, false);

function onPause() {
// Handle the pause event
}

要么

document.addEventListener("resume", onResume, false);

function onResume() {
    // Handle the resume event
}

0
投票

试图一些方法,当我用下面的代码和它的工作对我来说,注销用户。

  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); 

而且还准备写一个设备内这个监听器

© www.soinside.com 2019 - 2024. All rights reserved.