End.Game End.Game - 8 months ago 55
Android Question

Turn off/on wifi by wifi automatically by geolocation in Android

In my application I want to implement this feature: Turn Off or Turn On the wifi using the geolocation.

I mean, for example, when I come back home my wifi turn on and when go away it turns off. It would be best if the user gives the location as input. Does anyone have any sample code about it? For now to me even if the location is written by me directly in Java it's good too.


I do not know about geo location, but turning Wifi on/off can be done using the code below

WifiManager wifiManager = (WifiManager) getBaseContext().getSystemService(Context.WIFI_SERVICE);

To Enable


To Disable