开发者

GPS location change notification

Can I receive a notification on the GPS's locatio开发者_如何转开发n change?


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 use a BroadcastReceiver with

<action android:name="android.location.PROVIDERS_CHANGED" />

check here for an example

Detecting GPS on/off switch in Android phones

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜