【发布时间】:2010-06-25 21:25:45
【问题描述】:
您可以通过两种方式订阅 requestLocationUpdates
- 通过指定 PendingIntent 实现
- 另一个是使用 LocationListener
什么时候通知一个,什么时候通知另一个?
【问题讨论】:
标签: android geolocation android-pendingintent
您可以通过两种方式订阅 requestLocationUpdates
什么时候通知一个,什么时候通知另一个?
【问题讨论】:
标签: android geolocation android-pendingintent
如果需要位置更新的组件仅在组件存在时才需要更新——比如说,一个活动——我会使用LocationListener 方法。
如果需要特别更新位置的组件不会出现——比如IntentService——我会使用PendingIntent。在这种情况下,您不能使用 LocationListener,因为内存中没有任何内容可以监听位置。
【讨论】: