How do I block user to open their Wi-Fi? They cannot turn on their wifi from the Menu and Setting. When the user turn on their wifi, an alert will show and turn off the wifi. What should I type in my Button(A button that can be turn on and off)'s listener?
Asked
Active
Viewed 485 times
0
-
2Ok, I've got to ask... why are you trying to block a user from turning on their Wifi? – Adam Schiavone Mar 04 '13 at 01:00
-
If that could be allowed, then there is a new kind of malware. – StarPinkER Mar 04 '13 at 01:00
-
@AdamSchiavone My sister always play Facebook, WeChat, Instagram, ...So I want to block her to play – Ken Wong Mar 04 '13 at 14:48
1 Answers
0
If you have root access, you can refer to this question, which shows how to toggle Wifi on/off with WifiManager.setWifiEnabled()
, and the permissions needed. You'll need to listen in with a BroadcastReceiver
to know when the status has changed. This question shows how to do that.
If you don't have root access, you're out of luck. You can still listen for the status change to know when it's turned on, but you can't really do anything about it. Maybe throw a warning dialog or something, but you won't be able to turn it off.
-
I'm struggling to define root without using the word "root". [Try this link.](http://en.wikipedia.org/wiki/Root_access) I'm guessing, though, if you don't know what root means, you don't have it. Devices don't generally come with it by default. – Geobits Mar 04 '13 at 14:52
-
That's not a good question for this site. It's a different process for every device. [XDA Developers Forum](http://www.xda-developers.com/) is a good place to start looking for answers, though. – Geobits Mar 04 '13 at 15:05
-
-