android - Wake lock does not seem to work -
I am developing an app that requires a TCP connection to stay alive. I have a type The Ping / Pong system has been implemented, it works perfectly on the screen, but when the phone stops, the pings stop responding after a while. I have created a Wi-Fi wake lock but I am still experiencing the same problem ..
This is my code:
Private Wifi Manager Wm = GetSystemService (this.WIFI_SERVICE); Private Static WifiLock wl = Faucet; Public static zero lock () {wl = wm.createWifiLock (WifiManager.WIFI_MODE_FULL, app.TAG); If (! Wl.isHeld ()) {wl.acquire (); }} Public static zero unlock () {if (wl! = Null) {if (wl.isHeld ()) {wl.release (); }}}
Any ideas?
You must obtain PowerLock with SCREEN_DIM_WAKE_LOCK / PARTIAL_WAKE_LOCK flag.
Comments
Post a Comment