我可以通过此代码启动一个广播接收器,它检测我的位置更新
Intent intent = new Intent(
LocationChangedReciever.ACTION_LOCATION_CHANGED);
LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
long minTime = 1000; // This should probably be fairly long
float minDistance = 1; // This should probably be fairly big
String provider = "gps"; // GPS_PROVIDER or NETWORK_PROVIDER
PendingIntent launchIntent = PendingIntent.getBroadcast(this,
0, intent, 0);
manager.requestLocationUpdates(provider, minTime, minDistance,
launchIntent);
我是通过单击按钮完成的,但是一旦单击该按钮,接收器就开始一直工作,但是我有一个停止按钮,它将禁用接收器,但我做不到,除非我卸载它,否则该接收器可以工作,有什么帮助吗?