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

前端 未结 4 1397
深忆病人
深忆病人 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 15:57

    When the phone goes to sleep the onPause() method is called. This method is just a warning to your app. Then depending on the device the CPU may also go to sleep and execution of your code may stop. On most devices this may be anywhere from 10 to 60 seconds after the screen goes black.

    It is very unlikely that going to sleep will result in your app being killed.

提交回复
热议问题