我有一个使用 phonegap 2.1 的基于 phonegap 的应用程序,我添加了对后退按钮的处理。
@Override
public void onBackPressed() {
// Move the application to background on back button press.
if (!moveTaskToBack(false)) {
Log.e("myApp", "Failed to move the app to background");
}
return;
}
现在在带有 Android 4.1.1 的 Samsung Tab 上,当按下返回或主页按钮时,该应用程序会被终止。但是,相同的代码适用于具有 Android 4.2.2 的 Nexus 设备
这是日志猫
09-19 18:43:01.463: D/DroidGap(27265): onMessage(spinner,stop)
09-19 18:43:02.752: D/CordovaWebView(27265): >>> loadUrlNow()
09-19 18:43:02.760: D/WebView(27265): loadUrlImpl: called
09-19 18:43:02.760: D/webcore(27265): CORE loadUrl: called
09-19 18:43:02.767: D/webkit(27265): Firewall not null
09-19 18:43:02.767: D/webkit(27265): euler: isUrlBlocked = false
09-19 18:43:02.838: D/DroidGap(27265): Paused the application!
09-19 18:43:02.838: D/CordovaWebView(27265): Handle the pause
09-19 18:43:02.838: D/CordovaWebView(27265): >>> loadUrlNow()
09-19 18:43:02.838: D/WebView(27265): loadUrlImpl: called
09-19 18:43:02.877: D/webcore(27265): CORE loadUrl: called
09-19 18:43:02.877: D/webkit(27265): Firewall not null
09-19 18:43:02.877: D/webkit(27265): euler: isUrlBlocked = false
09-19 18:43:03.853: D/DroidGap(27265): onDestroy()
09-19 18:43:03.853: D/CordovaWebView(27265): >>> loadUrlNow()
09-19 18:43:03.861: D/WebView(27265): loadUrlImpl: called
09-19 18:43:03.861: D/webcore(27265): CORE loadUrl: called
09-19 18:43:03.861: D/webkit(27265): Firewall not null
09-19 18:43:03.861: D/CordovaWebView(27265): >>> loadUrlNow()
09-19 18:43:03.869: D/webkit(27265): euler: isUrlBlocked = false
09-19 18:43:03.869: D/WebView(27265): loadUrlImpl: called
09-19 18:43:03.869: D/webcore(27265): CORE loadUrl: called
09-19 18:43:03.869: D/webkit(27265): Firewall not null
09-19 18:43:03.869: D/webkit(27265): euler: isUrlBlocked = false