Due to the battery drainage, i want to switch ON/OFF the providers programmatically that is background mode. Previously i did with settings activity of providers. But i feel it is not user friendly.
Please help me?
Due to the battery drainage, i want to switch ON/OFF the providers programmatically that is background mode. Previously i did with settings activity of providers. But i feel it is not user friendly.
Please help me?
You can't control it at the system level. Only users are allowed to do that. But you can stop listening for GPS events using something like:
locationManager.removeUpdates(myLocationListener);
locationManager = null;
You can also launch the settings screen so the user can do it himself using:
if(!LocationManager.isProviderEnabled(android.location.LocationManager.GPS_PROVIDER ))
{
Intent myIntent = new Intent( Settings.ACTION_LOCATION_SOURCE_SETTINGS );
startActivity(myIntent);
}