Reputation: 157
I want to disable the wifi when not connect to any network. It will be running in the background and disabled anytime when wifi are enable and not used. How can I do that? Please give me some advice. I have to use Foreground or Service/ Broadcast Receiver.
Upvotes: 1
Views: 1171
Reputation: 2265
You may be interested in Tasker. It can automate basically every setting in Android.
You can make a profile State> Variable Value> %WIFI=on
Action: If "Wifi Info" %WIFII !contains "CONNECTION" then Net> Toggle Wifi> Off
You can also do this in Java with a bit more work. I can provide details on that if you request.
And also if you're lazy you can download neat little apps that take care of it for you: Auto Wifi Off
Hope that helps
Upvotes: 1