Android broadcast attivity no history -
I have a problem with the activity initiated by Broadcast Receiver.
I use this activity to overwrite the default lockscreen and I think the activity has not been mapped to the stack.
I try with different flags: FLAG_ACTIVITY_NO_HISTORY, FLAG_ACTIVITY_CLEAR_TOP, FLAG_ACTIVITY_CLEAR_TASK ... but they do all the work.
Recipient. Java
Public Class Receiver Expands Broadcast Receiver {Available on Public Empty (Reference Reference, Intent of Intent) {reference.startService (New Intent ( Context, MyService.class)); Intention = Intentional Intent (context, AppActivity.class); Intent.addFlags (Intent.FLAG_ACTIVITY_NEW_TASK); //intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); //intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); //intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); Context.startActivity; }
AndroidManifest.xml
& lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Manifest xmlns: Android = "http://schemas.android.com/apk/res/android" package = "com.lockscreen" Android: versionCode = "1" android: versionName = "1.0" & gt; & Lt; Usage-SDK Android: minSdkVersion = "8" /> & Lt; Application Android: Icon = "@ Drable / Icon" Android: label = "@ string / app_name" & gt; & Lt; Activity Android: name = "com.app.AppActivity" android: label = "@ string / app_name" android: theme = "@ android: style / theme." = "True" & gt; & Lt; Intent-Filter & gt; & Lt ;! - & lt; Action Android: name = "android.intent.action.MAIN" /> - & gt; & Lt ;! - & lt; Category android: name = "android.intent.category.LAUNCHER" /> - & gt; & Lt; / Intent-Filter & gt; & Lt; / Activity & gt; & Lt; Service Android: name = "com.app.MyService" Android: noHistory = "true" & gt; & Lt; / Services & gt; & Lt; Receiver Android: name = "receiver.receiver" Android: noHistory = "true" & gt; & Lt; Intent-Filter & gt; & Lt; Action Android: name = "android.intent.action.BOOT_COMPLETED" /> & Lt; / Intent-Filter & gt; & Lt; / Receiver & gt; & Lt; / Application & gt;
You modify the launch mode of your activity this way Can
& lt; Activity Android: name = "com.example.test" Android: configChanges = "orientation-screenSize" Android: launchMode = "single instance" & gt; & Lt; / Activity & gt;
Or you can use Android: Launchmode = " Singletsk " '
"Singletts" and "Single instances "Activities only start a job, they always stay in the root of the activity stack.
The difference between them:
"Singletts" and "single instance" mode differ from each other in only one respect Happens: A "Singletsk" activity allows other tasks to be part of their work, it always remains at the root of its work, but other tasks (essential "standard" and "single-ball" activities) launch in that work can be done. On the other hand, a "single instance" activity does not permit any other activity to be a part of its work.
As told here
Comments
Post a Comment