Search code examples
androidandroid-wifiandroid-internet

Android mobile-internet lock


I am currently working on the application for our clients that needs to have constant access to the internet through wi-fi or through 3G mobile internet.

I found that there is a "Wi-Fi Lock", that keeps the Wi-Fi radio on, however I didn't find anything similar for mobile internet. Is there something like that? Or you simply don't have to acquire lock for mobile internet and it will work even when the phone is idle? (unfortunately I can't test because I don't have mobile internet right now)


Solution

  • You cannot stop the user from manually disabling WiFi or mobile network data. However, some phones are set to automatically disable WiFi when the phone sleeps, here's when you can use a WiFi lock to keep WiFi going for as long as you need it, just remember to release the lock when you do not need it anymore.

    Mobile network data doesn't disconnect when the phone sleeps, so you do not need a lock for that.