Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stay awake over wifi debuging

I use WiFi ADB Active or ADB Wireless application to debug my build app in eclipse over Wifi instead USB debuging.

how I can keep turn on my device during debug? no options in this application to stay awake.

like image 842
mahdi Avatar asked Oct 21 '22 12:10

mahdi


1 Answers

When BuildConfig.DEBUG == true, spawn a thread, that calls Debug.WatiForDebugger then get a full wake lock. Periodically poll Debug.isDebuggerConnected(), releasing the wake lock if not.

WaitForDebugger will lock the thread until a debugger is attached (over wifi or not) - if that happens the wakelock will keep the device from sleeping. Once the debugger is disconnected, the next time the background thread checks the status of the debugger, it will release the wake lock and allow the device to sleep again.

like image 65
FunkTheMonk Avatar answered Oct 23 '22 11:10

FunkTheMonk