简体   繁体   中英

Android - Activity launched from the OS's app recent apps list

When the app is started from the OS's recent list, is there a way to ensure the normal launching activity actually starts or set the launching activity in the Manifest, or even prevent the app from OS launching from history?

ie

<category android:name="android.intent.category.(HISTORY)" />

I have an app where the state has to be set through a specific activity sequence so I'd like to ensure this without testing and calling finish() and startActivity() in onCreate() methods.

If you are talking about recent apps, you can use android:excludeFromRecents=["true" | "false"]

"Whether or not the task initiated by this activity should be excluded from the list of recently used applications ("recent apps"). That is, when this activity is the root activity of a new task, this attribute determines whether the task should not appear in the list of recent apps. "true" if the task should be excluded from the list; "false" if it should be included. The default value is "false". "

Ref: http://developer.android.com/guide/topics/manifest/activity-element.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM