Geofence - problem in triggering 'GEOFENCE_NOT_AVAILABLE'

混江龙づ霸主 提交于 2019-12-08 02:25:49

问题


I do app with geofencing use and since I started to work with it I get to broadcastReceiver the transitions and when I turned off the GPS location I got an alert with code GEOFENCE_NOT_AVAILABLE and I started a service to reregister the geofences when I will turn on the GPS. Now I took a few days break and suddenly my broadcastReceiver doesn't get alerts when I turn off the GPS. I don't understand why? *when I enter/exit from location (like I defined in the geofences init) I trigger the alerts, the problem is just at the triggering of the GEOFENCE_NOT_AVAILABLE alert.

I will glad if anyone can help me


回答1:


GEOFENCE_NOT_AVAILABLE is an expected error code, to let you know that the location adapter is off and location (and geofence) will not be tracked anymore.

Once available again, your geofences will be active and you will get the desired callback.

Few Reasons why the triggers aren't happening :

  1. Check if your expiry timestamp that you set in your geofence request, is still valid.
  2. Did you device get restarted ? If yes, you need to re-register fences. (Refer documentation : Re-register geofences only when required documentation)

  3. Is your location, set to High Accuracy mode in Device settings ?

  4. When you re-register your fences, you should un-register them first and then only re-register.

  5. Open Google maps and check if its showing the right location.



来源:https://stackoverflow.com/questions/57413993/geofence-problem-in-triggering-geofence-not-available

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!