ppa*_*rno 7 android android-location android-geofence
我已经开始在Android上开发具有最后定位服务功能:Geofences !! 模拟位置提供程序有任何已知问题吗?以下示例(https://developer.android.com/training/location/geofencing.html)即使当前位置在地理围栏内,我的意图服务也从未被解雇.我正在使用FakeGPS Android应用程序作为模拟位置提供商,如果我模拟路线,我会在Google地图应用上看到位置更改,因此模拟位置提供商运行良好.有任何想法吗 ?
谢谢.保罗.
小智 4
我一直在努力让它发挥作用。谷歌真是痛苦啊!因为它说可以使用模拟轻松测试地理围栏。
神奇的技巧是在传递给 setMockLocation 的位置中使用提供者名称“network”。
Location location = new Location("network");
location.setLatitude(latitude);
location.setLongitude(longitude);
location.setTime(new Date().getTime());
location.setAccuracy(3.0f);
location.setElapsedRealtimeNanos(System.nanoTime());
LocationServices.FusedLocationApi.setMockLocation(_googleApiClient, location);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3362 次 |
| 最近记录: |