什么时候在requestLocationUpdates上建议PendingIntent和LocationListener?

Pen*_*m10 4 android geolocation android-pendingintent

您可以通过两种方式订阅requestLocationUpdates

  • 一个通过指定PendingIntent
  • 另一种是使用LocationListener

什么时候被告知另一个?

Com*_*are 6

如果需要位置更新的组件仅在组件到达时需要更新 - 比如活动 - 我会使用该LocationListener方法.

如果特定需要位置更新的组件不在 - 例如,IntentService- 我会使用PendingIntent.LocationListener在这种情况下你不能使用,因为内存中没有任何东西可以监听位置.