I am writing app, that collects location data, based on GPS. And i have next problem: when i try to get GPS data and GPS is turned off, i show notification that ask for turning on GPS, and it starts(on click of course) intent with "AC开发者_如何学CTION_LOCATION_SOURCE_SETTINGS". Question: how can i know that user turned it on? is there some broadcasted actions, or i can set some listener, or something else?
public class MyLocationListener implements LocationListener
{
@Override
public void onLocationChanged(Location loc) {
GlobalHelper.handler.post(GlobalHelper.update_location);
}
@Override
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
GlobalHelper.system_message(provider + " Ausgeschaltet", 0,false);
}
@Override
public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub
GlobalHelper.system_message(provider + " Eingeschaltet",0,false);
}
@Override
public void onStatusChanged(String provider, int status,
Bundle extras) {
// TODO Auto-generated method stub
}
}
You can monitor android system settings, see Monitor Android system settings values
精彩评论