From the Android launcher source code,
if ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) !=
Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) {
//reset homescreen to default page
}
The launcher resets the homescreen to default page if the startActivity intent does not have the flag FLAG_ACTIVITY_BROUGHT_TO_FRONT.
The flag is only not set if there is already an instance of the activity being started at the top of the stack.
Is there a way to trick the launcher into thinking it’s already running in the top of the stack (causing it to reset the homescreen pages) when it is launched from another app? (not from home key press).
Follow my understanding about your question. I think FLAG_ACTIVITY_NEW_TASK flag can help you. The document say:
And If there is already an instance of the activity are running. Method :
will be called. So, you can reset your home screen from this method whenever there are a new intent come.
Hope it help.