- Start Activity A
- Activity A starts service S
- Service S runs in foreground mode and shows up a notification which when pressed takes the user to Activity B (singleTop!!)
- Activity B shows up
- Press HOME
- Go into DDMS and kill your apps process to simulate that your app died.
- Android will say "Rescheduling crashed service in 5000ms" (sometimes longer)
- Service S restarts and notification is shown.
- User now processes the notification icon...
...at this time, Android will recover both Activities A and B due to the fact the process ended unexpectedly. But despite the fact Activity B is singleTop android will spawn it AGAIN because the user clicked on the notification. This results into having A -> B -> B on the activity stack. Pressing back will take you again onto the first recovered instance of Activity B.
Can someone from the Android team clarify what is happening behind the scenes and how to avoid this? What is the best way to simulate that Android killed the process due to low memory? Is pressing STOP from DDMS good enough or an edge case and this should never happen under normal circumstances?
What is the difference between Force Stop from Settings --> Applications versus STOP from DDMS?
Thanks in advance!--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to firstname.lastname@example.org
To unsubscribe from this group, send email to
For more options, visit this group at