4
您可以通過specifing一個的PendingIntent通過兩種方式什麼時候建議requestLocationUpdates上的PendingIntent與LocationListener?
- 一個訂閱requestLocationUpdates
- 另一種是用LocationListener的
當告知一個,另一個是什麼時候?
您可以通過specifing一個的PendingIntent通過兩種方式什麼時候建議requestLocationUpdates上的PendingIntent與LocationListener?
當告知一個,另一個是什麼時候?
如果組件需要位置更新的組件只需要更新組件時 - 比如一個活動 - 我會使用LocationListener
方法。
如果需要位置更新的組件專門不在 - 比方說IntentService
- 我會使用PendingIntent
。在這種情況下,您不能使用LocationListener
,因爲內存中沒有任何內容可以偵聽位置。