完全关闭一个phonegap Android应用程序

Sat*_*iel 9 javascript android cordova

如何完全关闭PhoneGap Android应用程序?我尝试过使用device.exitApp()以及navigator.app.exitApp(),并且两者都有同样的问题.

问题是我有一个html文件index.html链接到外部html文件main.html.现在,如果我在没有转到外部文件的情况下点击关闭按钮,应用程序就会关闭.如果我转到外部文件,然后返回索引然后点击关闭,它关闭索引,但带来主要.无论我是否进入外部页面,如何完全关闭应用程序?

的index.html

<html>
<head>
    <script type="text/javascript" src="Scripts/phonegap-1.0.0.js"></script>
</head>
<body>
    <a href="index.html">Index</a>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

main.html中

<html>
<head>
    <script type="text/javascript" src="Scripts/phonegap-1.0.0.js"></script>
</head>
<body>
    <a href="index.html">Index</a>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

Android Manifest

<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".TestActivity"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name="com.phonegap.DroidGap" 
            android:label="@string/app_name" android:configChanges="orientation|keyboardHidden">
    </activity>
</application>
Run Code Online (Sandbox Code Playgroud)

Dev*_*eks 5

这就是PhoneGap Android如何与PhoneGap 1.0.0配合使用.

此行为已更改为更像您在PhoneGap 1.1.0中所期望的内容.尝试升级.

http://simonmacdonald.blogspot.com/2011/10/changes-in-phonegap-android-110.html

"现在,当您处理多个页面应用程序时,navigator.app.exitApp()会发生变化.此命令现在完全退出应用程序,不会返回上一页.如果您想返回页面,则应使用navigator.app.backHistory()".