获取我当前触发Geofence事件的位置

时间:2014-05-19 07:36:22

标签: broadcastreceiver intentservice android-geofence

我使用Android Location API注册Geofences。

是否有可能获得用户的位置在IntentService的onHandleIntent()方法或onReceive()方法中触发Geofence-Exit事件(使用BroadcastReceiver时)?

我目前的方法是使用LocationManager.getLastKnownLocation(String provider),但我不确定这是否可靠,因为我必须指定一个提供商而我不知道我的地理围栏位置所基于的提供商

onHandleIntent(Intent int)onReceive(Intent intent)中收到的意图也不包含任何有用的位置数据。

长话短说:

在Android中触发Geofence事件的获取位置是否有安全可靠的方法?

1 个答案:

答案 0 :(得分:1)

你可以使用

locationClient.getLastLocation();

此功能不需要提供者。这可能是获取位置的最佳方式,导致退出

相关问题