Question

Android documentation seems a bit vague about this feature.

I am using OkHttp to make network calls, and I was wondering if my application is suppose to get the wifi lock before making any network call? Is the wifi lock meant to be used for EVERY network call that is made from an app? Is the wifi lock useful if you are on WAN (4g)?

Was it helpful?

Solution

WiFi Lock is useful when you are doing something for longer period of time and you need keep WiFi on as long as it is possible to complete your work. Usually something like Service + network work, since screen can goes off and tablet can go sleep. Usually you do not need to use it if you just do small requests and it is fine to lose it if for example user clicked Home button and do not see your app's UI.

Hope this helps and answers your question.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top