I was trying to enable Wi-fi & Mobile Location setting using code but not got proper solution.
I am able to check if its enable or disable using below code.
String provider = Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
If provider having "network" string then wifi Location is enable otherwise disable.
But Can I do it with Pragmatically to directly Enable without prompt any dialog?
Is it posible?
startActivityForResult(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS), 0);
I know we can open the setting screen directly but don't want to open directly it will enable, same Like GPS.
Below link is work with GPS Satelitte option. But how to do with Wi-fi Location?
How can I enable or disable the GPS programmatically on Android?
I am using Android 4.2 version.
But Can I do it with Pragmatically to directly Enable without prompt any dialog?
Fortunately, no, for obvious privacy and security reasons.
Below link is work with GPS Satelitte option
Fortunately, most Android devices are not affected by this security flaw.