Is using WakeLock overkill while using WifiLock on Android?

后端 未结 1 1982
生来不讨喜
生来不讨喜 2021-01-19 00:50

My audio streaming app is working correctly with only WifiLock.

But some devices report that when they turn off the screen, connection is cut and audio streaming is

相关标签:
1条回答
  • 2021-01-19 01:23

    Use them both. The behavior I am sure varies from phone to phone. You may wish to search for the devices the reports are about + "wifi"or "wifi driver". Are you sure your audio streaming app is working correctly with only WifiLock ? This sounds very strange - the CPU will go to sleep and the service will stop - see Service, WakeLock. Something else is keeping the phone awake. So you need a wake lock

    If you only use wake lock on the other hand the wifi will turn off maybe - I am not sure for you are using it - but better safe than sorry. If it does turn off waking the phone up won't wake it up - for this I am sure. Using the wifi lock has no impact on the battery - using the wifi radio has, and this you are doing anyway.

    So both - and be sure your service acquires them - have a look at WakefulIntentService

    0 讨论(0)
提交回复
热议问题