Location Alerts - Why does it ask every time you reload the map?

339
2
03-27-2023 11:40 AM
JoabelBarbieri
Occasional Contributor II

Every time you open a map that has geofences it asks to enable alerts.. It's so annoying and time consuming. ESRI, Please deactivate that message or make it that you only have to enable once for a given map and not every day or time you reload/open it!!

2 Replies
JustinReynolds
Occasional Contributor III

It is a bit annoying but you can find the answers to the question by reading through how these things are implemented behind the scenes in the device's OS.

https://developer.android.com/training/location/geofencing.

Basically geofences are registered and run by the phone and not Field Maps 

First the geofence is registered with the device.  Field maps doesn't even have to be active or active in the background for them to work.  This is because it is a device level thing after the app registers the geofence.

Flipping the switch when prompted, opting in, registers the geofence with the device. Reloading the map, loading a different map, or disabling location alerts for a map un-registers the geofence with the device.
__________________

For Android:

Re-register geofences only when required

Registered geofences are kept in the com.google.process.location process owned by the com.google.android.gms package. The app doesn’t need to do anything to handle the following events, because the system restores geofences after these events:

  • Google Play services is upgraded.
  • Google Play services is killed and restarted by the system due resource restriction.
  • The location process crashes.

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.

______________________________

ESRI also informs the user to be transparent as a matter of best practice.

Explain to users why your app uses geofencing 

Because your app accesses location in the background when you use geofencing, consider how your app delivers benefits to users. Explain to them clearly why your app needs this access to increase user understanding and transparency.

For more information about best practices related to location access, including geofencing, see the privacy best practices page.

_____________________

But one of the bigger reasons is likely that API has a built-in limitation of the number of geofences an app can register.

"You can have multiple active geofences, with a limit of 100 per app, per device user. For each geofence, you can ask Location Services to send you entrance and exit events, or you can specify a duration within the geofence area to wait, or dwell, before triggering an event. You can limit the duration of any geofence by specifying an expiration duration in milliseconds. After the geofence expires, Location Services automatically removes it."

Hope this helps.

 

 

- Justin Reynolds, PE
JoabelBarbieri
Occasional Contributor II

yeah I tried to be as transparent as I can but users don't care much. I deal with foresters who are really annoyed having that FMA icon on the status bar all the time. They want to hide it but still get notifications. Others apps on Android seem to do that and now show a constant message on the bar. There must be a setting somewhere.

0 Kudos