android - At what point does my application code stop running when the device goes to sleep? -


specifically, if have method running in activity class, when phone goes sleep (cpu off), method run completion before onpause() called?

class myactivity extends activity {     ...     public void dosomework() {         ...         ... // <-- device goes sleep @ point in time         ...         return; // here before onpause() called?     }     ...     @override     public void onpause() {         ...     }     ... } 

in addition activities, running thread (perhaps launched activity class) interrupted at whatever line of code it's at when device goes sleep? see contradicting answers in post: does thread launched activity continue running once device goes sleep?

going further, understand activity's onresume() invoked when device wakes up; if dosomework() above or aforementioned thread indeed interrupted midway when going sleep, remaining code resume?

thanks in advance insight.

it's considered android practice not run long tasks on main ui thread, therefore dosomework() supposed finish within few hundred milliseconds , reach return statement before onpause() called.

regarding dosomework() interrupted midway -- possibility of happen when application shows dreaded anr dialog , force closes, should not concerned restarting halfway through.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -