Unknown intent flag at startup
I have Activity
with launchmode = "singleInstance"
, and this is an Activity
app. Now I am trying to determine which of Flag
my Activity
was / will be launched from, but I cannot find the flag ID from Intent
Flag
on the document page ; this is a flag
String version of the Flag id is 270532608
and the string version of the Intent
04-25 20:18:57.061: V/logtag(1665): Intent { act=android.intent.action.MAIN
cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=<filtered> }
when the app first starts, the system calls mine Activity
with this Flag
= Intent.FLAG_ACTIVITY_NEW_TASK
or the version = line 268435456
(which should), but when I exit the app and run it again from I run this flag 0x10200000
instead of the previous flag
so my question is, can someone tell me what this flag is?
and why is my activity called with her?
and are there any other instances from the launcher that my activity can be started with a flag other than unknown and 0x10200000?
source to share
This is a combination of flags:
public static final int FLAG_ACTIVITY_NEW_TASK = 0x10000000;
and
public static final int FLAG_ACTIVITY_RESET_TASK_IF_NEEDED = 0x00200000;
0x10000000 is the hexadecimal notation for 268435456.0x00200000
is the hexadecimal notation for 2097152.
If you add these numbers, you get:
0x10200000, which is the hexadecimal notation for 270532608.
So the first time you run the app you will get FLAG_ACTIVITY_NEW_TASK
, but the second time you will also get FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
. It's just a bitwise OR operation. To check if your desired flag is active, you can bitwise and like this:
boolean hasNewTaskFlag = (flg & FLAG_ACTIVITY_NEW_TASK) != 0;
source to share
First of all, this value flag
0x10200000
is in Hexadecimal
, not in Decimal
, so you might not find any useful information if you try to Google it.
This is why you have to convert to decimal first. Then you will see the real value flag
is equal 270532608
, which means starting a new task compared to the previous one
why is my activity called with her?
Because you are probably resuming the instance that was in the background (recent apps list). Don't start a new instance
If you would like to know more about this intention, click here
source to share