我应该如何定义launchMode在AndroidManifest.xml - 使用PhoneGap& JQM [英] How should I define launchMode in AndroidManifest.xml - Using PhoneGap & JQM

查看:476
本文介绍了我应该如何定义launchMode在AndroidManifest.xml - 使用PhoneGap& JQM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在努力将我的应用程式限制为单一执行个体。目前,如果用户按下主屏幕退出应用程序,然后做一些外部的事情,并再次点击应用程序的图标,它启动应用程序的第二个实例。

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:

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.mydomain.qfa"
      android:versionCode="4"
      android:versionName="1.3">


<uses-sdk android:minSdkVersion="7"
          android:targetSdkVersion="13"
          android:maxSdkVersion="18" />

<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" />

<application 
             android:debuggable=["false"]
             android:testOnly=["false"]
             android:icon="@drawable/icon.png"
>
<activity 
            android:name="com.mydomain.qfa"
            android:launchMode=["singleTask"]
            android:alwaysRetainTaskState="true"
            android:icon="@drawable/icon.png"
>
</activity>

</application>
</manifest>

它是一个单一的活动应用程序在主JQM页面上我有这样的条目:

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"

或应该像

android:name="com.mydomain.qfa.HomePage"?

android:name="com.mydomain.qfa.MainContent"?

感谢提前。

推荐答案

我为这个问题奋斗了2天。添加此属性的修复程序最近才在3.5版中添加到Cordova中, issue CB-6048

I struggled with this problem for 2 days. The fix for adding this attribute was only recently added to Cordova as of 3.5, issue CB-6048

add:

<preference name="AndroidLaunchMode" value="singleTask" />

到config.xml

to config.xml

值:


  • standard

  • singleTop

  • singleTask

  • singleInstance

  • "standard"
  • "singleTop"
  • "singleTask"
  • "singleInstance"

这篇关于我应该如何定义launchMode在AndroidManifest.xml - 使用PhoneGap&amp; JQM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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