gpt4 book ai didi

android - 启动器应用程序和主页键不一致

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:12:45 27 4
gpt4 key购买 nike

我一直在构建一个包含许多 Activity 的启动器应用程序。当按下主页键并且他们将我的应用程序设置为默认启动器时,我希望主页按钮始终将用户带回 mainActivity。这在 90% 的时间都有效,但过了一段时间后,home 键最终停止工作。它记录了用户的按下,但不再将它们返回到主 Activity 。造成这种情况的原因让我回避了。我们已经尝试了几个月来以某种一致性重新创建错误,但无济于事。我们无法弄清楚是什么原因导致它停止工作。下面是我的 list 。我想知道我是否缺少某种旗帜或其他东西。

<?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>

最佳答案

我相信您遇到的问题可以通过将 Home 替换的主要 Activity 作为一个任务来解决。

要做到这一点,您需要将以下行作为主要 Activity 的一部分添加到您的 list 中:launchMode="singleTask" 关于它的作用的描述可以在here 中找到。 .

现在,只要您的应用收到主页按键事件并且应用未运行,它就会使用 onCreate 启动一个新实例。如果应用程序已经在前台运行或处于挂起状态,onNewIntent 将在您的主要 Activity 中调用,并将其带到前台。

关于android - 启动器应用程序和主页键不一致,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12693941/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com