Android 启动器应用程序和主密钥不一致

Android 启动器应用程序和主密钥不一致,android,android-manifest,android-launcher,Android,Android Manifest,Android Launcher,我一直在构建一个包含许多活动的启动器应用程序。我希望当按下home键并且他们将我的应用程序设置为默认启动程序时,home按钮总是将用户带回Main活动。这在90%的情况下有效,但一段时间后,home键最终停止工作。。它注册用户的按键,但不再将其返回到主活动。是什么原因使我无法理解。。几个月来,我们一直试图以一定的一致性重新创建这个bug,但没有成功。我们不知道是什么原因导致它停止工作。。下面是我的舱单。我想知道我是不是错过了什么旗帜什么的 <?xml version="1.0" encod

我一直在构建一个包含许多活动的启动器应用程序。我希望当按下home键并且他们将我的应用程序设置为默认启动程序时,home按钮总是将用户带回Main活动。这在90%的情况下有效,但一段时间后,home键最终停止工作。。它注册用户的按键,但不再将其返回到主活动。是什么原因使我无法理解。。几个月来,我们一直试图以一定的一致性重新创建这个bug,但没有成功。我们不知道是什么原因导致它停止工作。。下面是我的舱单。我想知道我是不是错过了什么旗帜什么的

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.sapientnitro.lcinstore2"
    android:configChanges="keyboard|uiMode"
    android:versionCode="4"
    android:versionName="4.0" >

<uses-sdk android:minSdkVersion="15" />

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
<uses-permission android:name="android.permission.VIBRATE" />

<uses-feature android:name="android.hardware.camera" />

<application
    android:icon="@drawable/icon"
    android:label="@string/app_name" >
    <activity
        android:name=".activities.LCInStore2Activity"
        android:alwaysRetainTaskState="true"
        android:configChanges="orientation|keyboardHidden"
        android:label="@string/app_name"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.HOME" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.MainActivity"
        android:configChanges="keyboard|uiMode"
        android:label="Main"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.MAINACTIVITY" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.Authenticate"
        android:label="Authenticate"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.AUTHENTICATE" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.Settings"
        android:label="Settings"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.SETTINGS" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.CustomerHome"
        android:label="CustomerHome"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.CUSTOMERHOME" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.CustomWebView"
        android:label="CustomWebView"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.CUSTOMWEBVIEW" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.CustomCamera"
        android:label="CustomCamera"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.CUSTOMCAMERA" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.FavoritesCustomer"
        android:label="FavoritesCustomer"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.FAVORITESCUSTOMER" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.FavoritesAssociate"
        android:label="FavoritesAssociate"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.FAVORITESASSOCIATE" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.Browser"
        android:hardwareAccelerated="true"
        android:label="Browser"
        android:screenOrientation="landscape" >

        <!-- android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> -->
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.BROWSER" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.VideoViewer"
        android:label="Video Viewer"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.VIDEOVIEWER" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.GalleryOneUp"
        android:label="GalleryOneUp"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.GALLERYONEUP" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.GalleryFourUp"
        android:label="GalleryFourUp"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.GALLERYFOURUP" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.GeneralRx"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:label="GeneralRx"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        android:windowSoftInputMode="stateHidden" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.GeneralRX" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.SunglassRx"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:label="SunglassRx"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        android:windowSoftInputMode="stateHidden" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.SunglassRX" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.ComputerRx"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:label="ComputerRx"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        android:windowSoftInputMode="stateHidden" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.ComputerRX" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.NightGlassesRx"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:label="NightGlassesRx"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        android:windowSoftInputMode="stateHidden" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.NightGlassesRX" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.ActiveRx"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:label="ActiveRx"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        android:windowSoftInputMode="stateHidden" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.ActiveRX" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.SafetyRx"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:label="SafetyRx"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        android:windowSoftInputMode="stateHidden" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.SafetyRx" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.ContactRx"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:label="ContactRx"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        android:windowSoftInputMode="stateHidden" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.ContactRx" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.SettingsRx"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:label="SettingsRx"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        android:windowSoftInputMode="stateHidden" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.SettingsRX" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

    <receiver android:name=".SettingsReceiver" >
    </receiver>

    <activity
        android:name=".activities.CEETraining"
        android:label="@string/title_activity_ceetraining"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.CeeTraining" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.BrandTraining"
        android:label="@string/title_activity_brand_training"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.BrandTraining" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.LensTraining"
        android:label="@string/title_activity_lens_training"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.LensTraining" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.MakeAbility"
        android:label="@string/title_activity_makeability"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.Makeability" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.MakeabilityResults"
        android:label="@string/title_activity_makeability_results"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
        <intent-filter>
            <action android:name="com.sapientnitro.lcinstore2.activities.Makeabilityresults" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
</application>

</manifest>

我相信你的问题可以通过让你的家庭替代者的主要活动成为一项单一任务来解决

要做到这一点,您需要将以下行作为主要活动的一部分添加到清单中:
launchMode=“singleTask”


现在,每当您的应用程序收到home按键事件且应用程序未运行时,它都会使用
onCreate
启动一个新实例。如果应用程序已在前台运行或处于挂起状态,则会在您的主要活动中调用onNewIntent,并将其带到前台进行说明。

。我假设您在logcat中看到home按钮的关键事件(它注册用户的按下)?你怎么知道你的目的不是进入你的应用程序?我假设onResume()中没有任何内容可以说明我们使用的是4.0.4三星平板电脑。。我知道home键正在启动,因为它会弹出一个窗口,询问我们想要哪个启动器(我们的应用程序在列表中),但它不会返回到主活动。当用户从可用启动器列表中选择你的应用程序时,它不会返回到主活动?不是所有时间都没有!当我们第一次安装应用程序时,它在大多数情况下都会在一段时间内表现完美。。大概一天,但之后就不再像预期的那样。。有时,它在安装后不能立即工作。。我们卸载并重新安装,它工作正常。。再一次。。只有有限的时间。。另一个注意事项是,我们只能在已签名的apk上重新创建此错误。。该漏洞在使用调试版本的应用程序时从未发生。当按下home键时选择要启动的应用程序时,您的主要活动是否在OnEvent中获取任何信息?这始终会触发从应用程序外部调用的OnContent。。谢谢将让您知道它是否修复了错误。。很难说这个虫子是从哪里冒出来的谢谢@MCeley。我也有同样的问题。添加启动模式作为“singleTask”有效。