App A has an main activity that launch mode set as standard, open it. When I reopen it from system launcher, everything looks normal. But if start app A through another app B, A restart! Why?
My code:
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("A's package name");
launchIntent.setAction(Intent.ACTION_MAIN);
launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
launchIntent.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(launchIntent);
The default
android:launchMode
of the activity isStandard
according to https://developer.android.com/guide/topics/manifest/activity-element.html#lmodeFrom the link above :
So the onCreate() will be called as much time as you start the intent
This was for your app, for Android launcher it is different, it uses
Tasks
which aredefined here https://developer.android.com/guide/components/tasks-and-back-stack.html
These tasks conserve the order of the activities in the stack so it knows which one to resume first.
This quotation answers your question about Android Device Home Screen :