0

If you are attempting to obtain a WIFI lock, what if the WIFI is already off? Do i need to check the state of the WIFI, turn it on if not on, and then acquire a WIFI lock or will the act of grabbing a WIFI lock turn on the WIFI?

Might you have a source example of checking WIFI state, and turning it on if off.

Thanks

iBoston
  • 69
  • 1
  • 9
  • 1
    A WiFi lock is used to keep the radio on when WiFi is already enabled. It has nothing to do with, and cannot affect, whether or not WiFi is itself on/off. http://developer.android.com/reference/android/net/wifi/WifiManager.WifiLock.html – Charlie Collins Apr 23 '13 at 15:42
  • Also, here's more info in enabling/disabling WiFi: http://stackoverflow.com/questions/3930990/android-how-to-enable-disable-wifi-or-internet-connection-programmatically. Note, to do that programattically you need some potentially far-reaching (and scary) permissions. A better approach might be to detect when you need it and offer to take the user to settings so they can enable/disable as required (as opposed to including those perms and just doing it for them). – Charlie Collins Apr 23 '13 at 15:46
  • Thank you Charlie.. Perfect... Yea, it will be a user option as to whether or not to keep the Wifi enabled. This program is more for family and friends then to general public. – iBoston Apr 23 '13 at 15:53

0 Answers0