When I start service which send some data to server every few seconds I acquire
wakeLock
PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MyWakelockTag");
wakeLock.acquire();
and wifiLock
WifiManager wMgr = (WifiManager) getSystemService(Context.WIFI_SERVICE);
wifiLock = wMgr.createWifiLock(WifiManager.WIFI_MODE_FULL, "MyWifiLock");
wifiLock.acquire();
But if device is not touched for one hour and is in sleep mode wifi stop working. Is this normal behaviour and if not, what should I do to lock device until release()
method are called?