我可以收到有关GPS位置变化的通知吗?
答案 0 :(得分:3)
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
}
}
答案 1 :(得分:0)
您可以使用BroadcastReceiver
和
<action android:name="android.location.PROVIDERS_CHANGED" />
点击此处查看示例