开发者

Does a Thread launched by Activity continue running once the device goes to sleep?

开发者 https://www.devze.com 2023-04-03 22:10 出处:网络
This is somewhat similar to App seems to stop working when the screen goes to sleep however they discuss an AsyncTask while in my situation it is a plain Thread.

This is somewhat similar to App seems to stop working when the screen goes to sleep however they discuss an AsyncTask while in my situation it is a plain Thread.

So let's say an activity starts a Thread, and then the pho开发者_StackOverflowne goes to sleep, does the thread continue execution?


Not unless you have a wakelock. (It does continue to run if your activity goes to the background, but might be killed at any time the foreground activity requires more resources.)

0

精彩评论

暂无评论...
验证码 换一张
取 消