navigator.app.exitapp()在Android设备不工作 [英] navigator.app.exitapp() not working in android device

查看:720
本文介绍了navigator.app.exitapp()在Android设备不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  document.addEventListener("deviceready", onDeviceReady, false);
  function onDeviceReady() {
  document.addEventListener("backbutton", backButtonEvent, false);
}
   function backButtonEvent() {
    var currentUrl=window.location.hash;
     if(currentUrl=='#/homePage' || currentUrl=='#/'){
navigator.app.exitApp();
 }
else{
  history.go(-1);
  navigator.app.backhistory();
  }
}

使用的IAM框架离子和电话的差距。这里当我从主页中,单击设备后退按钮它只是最大​​限度地减少应用程序不退出。我怎么能离开我的应用程序?

Iam using ionic framework and phone gap.. here when i click device backbutton from home page its just minimizing that app not exiting. How can i exit my app??

推荐答案

如果您通过意味着最大限度地减少应用程序应用程序转到后台(是不是活动的应用,但它仍然是在运行应用程序的列表)。如果是你的意思,请注意,这是Android和许多移动操作系统的正常行为。

In case you mean by minimizing that app that the application goes to the background (is not the active application but it is still in the list of running applications). In case that is what you mean, please notice that this is the normal behavior in Android and many Mobile OS.

终止(退出,如果你preFER)的应用程序不是应用程序开发者的控制之下。它完全由OS(Android的在这种情况下)进行管理。所以,你有什么是下Mobile操作系统的应用程序的正常行为。

Terminating (exiting if you prefer) the application is not under the control of the application developer. It is completely managed by the OS (Android in this case). So, what you have is the normal behavior for apps under Mobile OS.

而不是终止应用程序,你会在旧的操作系统做(Linux,Windows和一样),你必须管理应用程序的生命周期:暂停恢复 ...

Instead of terminating the application as you would do under old OS (Linux, Windows and alike), you have to manage the lifecycle of the application: pause, resume, ...

这篇关于navigator.app.exitapp()在Android设备不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆