Android:如何取消有意图的位置更新请求?

wei*_*wei 6 android

我在requestLocationUpdates(provider,minTime,minDistance,PendingIntent)中注册了PendingIntent.但是当我的广播接收器收到此打算时,如何使用removeUpdates(PendingIntent)删除此请求?接收方不保留对原始PendingIntent的引用.

Com*_*are 9

你创建一个等价物PendingIntent.换句话说,创建一个Intent与您最初使用的匹配项(尽管您可以跳过任何其他内容),将其包装在PendingIntent您最初使用的那种PendingIntent中,并在removeUpdates()调用中使用它.