It's too late to post an answer, but maybe it will help someone. Since I ran into the same problem and got a solution like:
WifiManager wm = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE); wifiLock = wm.createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF , "MyWifiLock"); wifiLock.acquire(); PowerManager pm = (PowerManager) getApplicationContext().getSystemService(Context.POWER_SERVICE); wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MyWakeLock"); wakeLock.acquire();
And release the locks in the destruction method:
if (wakeLock != null) { if (wakeLock.isHeld()) { wakeLock.release(); } } if (wifiLock != null) { if (wifiLock.isHeld()) { wifiLock.release(); } }
In your case, I think you do not have enough locks. See this link .
source share