android–Geofence触发程序解释需要吗?

android–Geofence触发程序解释需要吗?,第1张

概述所以我创建了地理围栏如下:GeofenceModelmodelExit=newGeofenceModel.Builder("id_oi_456").setTransition(Geofence.GEOFENCE_TRANSITION_DWELL).setExpiration(Geofence.NEVER_EXPIRE).setLatitude(40.414341)

所以我创建了地理围栏如下:

    GeofenceModel modelExit = new GeofenceModel.Builder("ID_oi_456")                .setTransition(Geofence.GEOFENCE_Transition_DWELL)                .setExpiration(Geofence.NEVER_EXPIRE)                .setLatitude(40.414341)                .setLongitude(49.928548)                .seTradius(CLIENT_GEOFENCE_RADIUS)                .build();    SmartLocation.with(this).geofencing()                .add(modelExit)                .start(this);

我运行这个代码一次,当它停留在地理围栏内时会触发(如预期的那样).然后我删除该代码段并重新运行该项目.但即使我设置了NEVER_EXPIRE,这次也没有触发地理围栏.基本上我想知道的是geonfences存储在哪里.如果它们存储在应用程序内存之外,那么为什么“删除代码段”会清除地理围栏?

解决方法:

我认为它按预期工作.重新运行的项目将把应用程序视为全新安装.如文档中所述 – Use Best Practices for Geofencing:

The app must re-register geofences if they’re still needed after the following events, since the system cannot recover the geofences in the following cases:

The device is rebooted. The app should Listen for the device’s boot complete action, and then re- register the geofences required.The app is uninstalled and re-installed.The app’s data is cleared.Google Play services data is cleared.The app has received a GEOFENCE_NOT_AVAILABLE alert. This typically happens after NLP (AndroID’s Network Location ProvIDer) is Disabled.

希望这可以帮助.

总结

以上是内存溢出为你收集整理的android – Geofence触发程序解释需要吗?全部内容,希望文章能够帮你解决android – Geofence触发程序解释需要吗?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1102732.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存