When an alarm notification goes off and I activate the app from the notification, I want my application to resume at the same activity as when it was pushed into the background.
Right now, the PendingIntent is coded as follows:
PendingIntent pi = PendingIntent.getActivity(context, 0, new Intent(context, MyAppActivity.class), 0);
This always resumes at the main activity MyAppActivity.
How can I make it resume at the last activity before it was pushed into the background?
One other way could be setting the flag of the intent FLAG_ACTIVITY_NEW_TASK.
Havent tried this. But this could work.
You could go through this. It has most of the scenarios related to app switching.
http://developer.android.com/guide/topics/fundamentals/tasks-and-back-stack.html