问题描述
我正在努力将我的应用程序限制为单个实例.目前,如果用户按下主屏幕退出应用程序,然后在外面做一些事情并再次点击应用程序的图标,它会启动应用程序的第二个实例.
这是我的完整清单文件:
<uses-permission android:name="android.permission.INTERNET"/><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/><uses-permission android:name="android.permission.READ_PHONE_STATE"/><申请机器人:调试= [假"]android:testOnly=["false"]android:icon="@drawable/icon.png"><活动android:name="com.mydomain.qfa"android:launchMode=["singleTask"]android:alwaysRetainTaskState="true"android:icon="@drawable/icon.png"></活动></应用程序></清单>
它是一个单一的活动应用程序(基本上没有定义活动).在主 JQM 页面上,我有类似这些条目的内容:
<div data-theme="d" data-role="header" data-position="fixed" style="padding-bottom: 0px;"data-tap-toggle="false"><div data-role="navbar"><div data-role="content" class="MainContent" style="overflow:hidden; padding-top: 0px;">
谁能告诉我我的 Manifest 是否正确以及我是否应该使用
android:name="com.mydomain.qfa"
或者应该是其他类似的东西
android:name="com.mydomain.qfa.HomePage"?
或
android:name="com.mydomain.qfa.MainContent"?
提前致谢.
我为此问题苦苦挣扎了 2 天.添加此属性的修复添加到 Cordova 3.5,issue CB-6048
添加:
到 config.
其他可用值:
- 标准"
- 单顶"
- 单一任务"
- 单个实例"
I am struggling to restrict my application to a single instance. Currently if the user presses home screen to quit the application, then does something outside and clicks on the application's icon again, it launches the App's second instance.
Here is my complete manifest file:
<?
Its a single activity app (basically no activities defined). On the main JQM page i have something like these entries:
<div data-role="page" id="HomePage">
<div data-theme="d" data-role="header" data-position="fixed" style="padding-bottom: 0px;" data-tap-toggle="false">
<div data-role="navbar">
<div data-role="content" class="MainContent" style="overflow:hidden; padding-top: 0px;">
Can someone please tell me if my Manifest is correct and if I should be using
android:name="com.mydomain.qfa"
or should it something else like
android:name="com.mydomain.qfa.HomePage"?
or
android:name="com.mydomain.qfa.MainContent"?
Thanks in Advance.
解决方案
I struggled with this problem for 2 days. The fix for adding this attribute was added to Cordova as of 3.5, issue CB-6048
add:
<preference name="AndroidLaunchMode" value="singleTask" />
to config.
Other available values:
"standard"
"singleTop"
"singleTask"
"singleInstance"
这篇关于我应该如何在 AndroidManifest.