0

I created an app with the geofencing concept. After testing the app is not triggering geofences efficiently, So I want to know whether geofences are available at that time or not in the app.

Anyone, please provide a code to know whether the geofences are available or not

How to know whether the geofences are available or not

  • A geofence is a geofence. Unclear what you mean with the availability of a geofence. – blackapps Apr 17 '23 at 14:11
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Apr 17 '23 at 21:42

1 Answers1

0

On Android, there is unfortunately no way to ask the system about which geofences you have previously created. You must therefor keep track of every geofence you have created yourself. I do this by writing data containing information about the geofence (lon, lat, accuracy, name etc.) to a text file so that I later can retrieve them when I need.


This is also necessary for another reason - your geofences can be cleared at various times, the most common being device reboot. You need to register a BroadcastReceiver that gets called by the system when a device starts up. In there you need to know what geofences you want to create and do that again.

Mathias
  • 3,879
  • 5
  • 36
  • 48