What happens to Activities/Services when phone goes to sleep/standby mode?

前端 未结 4 1384
深忆病人
深忆病人 2021-02-20 15:39

What happens to android application and activities and services that belongs to application when the phone/AP goes to sleep mode?Will the framework destroy Activities and Servic

4条回答
  •  忘掉有多难
    2021-02-20 16:15

    What i saw in my application is that only the onPause() method of the main activity (category.LAUNCHER) is called. This happened when the phone went to sleep and before that the main activity of the application had been started.

    When any one of the other activities had been started before the phone was going to sleep the first onPause() is called then onStop() and in the end onDestroy() - this is for activities which are category.DEFAULT into the manifest.

    I don't know maybe the problem is in my code?

提交回复
热议问题