开发者

Can I listen for GPS changes?

开发者 https://www.devze.com 2023-02-22 09:27 出处:网络
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(o

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

0

精彩评论

暂无评论...
验证码 换一张
取 消