Skip to content Skip to sidebar Skip to footer

Android Changes Activity When It Goes To Sleep

I'm maintaining an Android app that controls an industrial process. It has a main Activity/screen which allows you to selects various industrial tasks, and each task has its own a

Solution 1:

When android goes to sleep, the top most activity receives onPause, but it still remains as the top most activity in the activity stack, and therefore it will receive onResume and will be started when the device awakes.

The reason you see your main activity when the device wakes up is that there should be some code in your onPause which forces the top most activity to finish after onPause (similarly there might be some settings. For example, setting noHistory to true in AndroidManifest.xml for an activity forces the activity to shutdown itself when it receives onPause, and so when you go back, you will see Main Activity on top).

Post a Comment for "Android Changes Activity When It Goes To Sleep"