Basically you answered your question :-)
Just mimic what Android does when the application starts:
Intent intent = new Intent(context, LoginForm.class); intent.setAction(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
or you can try this (assuming LoginForm is the root activity of your application and that an instance of this action is still active in the task stack):
Intent intent = new Intent(context, LoginForm.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
Setting FLAG_ACTIVITY_NEW_TASK should simply lead to the completion of the task for the application from the background to the foreground, without actually creating an instance of the action. Try it first. If this does not work for you, do something else.
David wasser
source share