My audio streaming application only works correctly with WifiLock.
But some devices report that when they turn off the screen, the connection is interrupted and the audio streaming is exceeded. (They say this does not happen in 3G)
So, I thought that maybe I can also use Partial WakeLock. I'm not sure if this fixes the problem, but I think this is an option. At the same time, adding WakeLock while working with basic WifiLock can drain the battery faster and may not solve the problem.
What do you think of adding WakeLock for this type of problem and application?
private static WifiLock wifiLock = ((WifiManager) appInstance().getSystemService(Context.WIFI_SERVICE)) .createWifiLock((android.os.Build.VERSION.SDK_INT>=12?WifiManager.WIFI_MODE_FULL_HIGH_PERF:WifiManager.WIFI_MODE_FULL), "myappwifilock");
Recently added line:
private static WakeLock wakeLock= ((PowerManager) appInstance().getSystemService(Context.POWER_SERVICE)).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "myappwakelock");
(Of course, I acquire and release these locks to create a service and to destroy it.)
android android-wifi android-wake-lock
frankish
source share