I have an android app that uses location. But I noticed that if users disable the \'Access to my location\' in Settings > Location access, nothing works anymore. How can I check
There are two ways to check location, 1-using GPS 2-using network provider its better to check both service are enabled or not.For that use this method :)
public boolean checkServices(){
//check location service
LocationManager locationManager = (LocationManager)getActivity().getSystemService(Context.LOCATION_SERVICE);
if(locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER) &&
locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)){
return true;
}
}