我正在使用 Android Location API 来注册地理围栏。
onHandleIntent()
是否可以在 IntentService 的方法或onReceive()
方法(使用 BroadcastReceiver 时)中获取触发 Geofence-Exit 事件的用户位置?
我目前的方法是使用LocationManager.getLastKnownLocation(String provider)
,但我不确定这是否可靠,因为我必须指定一个提供者,而且我不知道我的 Geofence-Location 是基于哪个提供者。
接收到的 IntentonHandleIntent(Intent int)
或onReceive(Intent intent)
也不包含任何有用的位置数据。
长话短说:
是否有一种安全/可靠的方式来获取在 Android 中触发地理围栏事件的位置?