可能重复:
位置管理器不会删除位置更新!
我为 LocationManager [GPS_PROVIDER] 添加了一个带有待处理意图的广播侦听器。
所以现在当我在电话位置管理器上关闭我的应用程序时,正在完美地更新广播监听器,所以这工作正常。
问题是,我想停止 LocationManager 来更新广播监听器,但我不能这样做。我再次运行该应用程序并使用 locationManager.removeUpdates 函数来停止它,但它仍将位置更新到广播管理器。
启动位置管理器:
Intent intent = new Intent("com.test.geoL.RECEIVE"); //Broadcast Receiver Action
PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(),0, intent, 0);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,
0, pendingIntent);