Geofencing
Location-based services |
---|
Geofencing is a location-based service in which a software application uses GPS to trigger a pre-programmed action when a mobile enters or exits a virtual boundary set up around a geographical location, known as a geofence.
The geofencing feature of Resco mobile apps (Android, iOS) introduced in release 17.1 allows you to get immediate updates when your front-line workers enter or leave one of your predefined locations (such as office, service location, etc.). This works reliably on a wide range of devices with minimal battery impact and improved user privacy (only presence at pre-set locations is monitored, not the overall location).
- Configure the tables you want to geofence in Woodford.
- When mobile users enter the specified location, a mobile audit event is generated. This works even if the app is in the background, the screen is off, etc.
- Capture mobile audit event on your backend to trigger additional logic (e.g., using Power Automate to update work order status).
Prerequisites
- Woodford (release 17.1 or later)
- Resco Mobile CRM app (release 17.1 or later): Android or iOS version
- Microsoft Power Platform, Dynamics, Salesforce, or Resco Cloud
Woodford configuration
- Start Woodford and select Location-based services from the Administration menu.
- Register one dedicated user for your organization. It is required for our real-time flushing service which forwards resco_mobileaudit records to your CRM under this user.
- Edit an app project and select Maps & Routes > Geofencing from the Project menu.
- Enable geofencing and set it up as needed (see below)
- Save all changes and publish the app project.
Usage in the app
After syncing Resco Mobile CRM app with an app project that has an active geofencing configuration, the app will require several additional permissions
- Notifications
- Location > Allow all the time
- Background location
- Battery > Unrestricted
If you enable notifications in geofencing configuration in Woodford and grant the appropriate permissions, users will receive notifications, for example when they enter a geofence. Clicking the notification opens the record that initiated the geofence. Before displaying the form, app checks whether the record is changed on server.
The Send Log action in About dialog includes new "realtime.log". If diagnostic log is enabled, it contains details about all geofencing events including each Enter/Exit event with anonymous ID of record which is related to the geofence.
Known issues
- Some Android vendors have their own layer of security blocking the background startup/autostart. User must explicitly allow it for Resco Mobile CRM app. This applies to Xiaomi, Vivo, Oppo, Huawei, and maybe also others.
- On Android devices, results are much more reliable if device has an active mobile connection.
- On iOS devices, results are much more reliable if device has Wi-Fi enabled (active connection is not necessary).
Consuming geofence events
The mobile audit data generated from the app can be further processed on the server, for example, using Power Automate/Power Platform workflows. There's a small difference between location tracking and geofencing that must be adjusted in server-side processing. Both services produce the same resco_mobileaudit
entity records. However, geofencing produces records with different resco_operation
values:
- GeoFenceEnter (value 473220012)
- GeoFenceExit (value 473220013)
- instead of original GpsChanged (473220011)
In addition to that, geofencing audit records contain a reference to the originating bookable resource booking/appointment table row (or other tables) that is associated with the triggered geofencing event, as well as the latitude and longitude fields. A mobile audit record has these reference fields:
resco_entityname
with the logical name of the initiating table (entity)resco_entityid
with the id of the initiating table row (record)resco_latitude
andresco_longitude
The createdby
field of the audit record always contains the user registered in the location-based services section of Woodford. Use ownerid
field to identify the user logged in on that mobile device.
Troubleshooting
For testing, we recommend the following configuration:
- Set Log verbosity to "Diagnostic".
- Allow all business days and hours (00:00 – 23:59).
- Don't use a geofence radius smaller than 100 meters.
- Make sure to choose the right latitude/longitude fields.
- Use a defensive filter (not to exclude some records). Remember that this filter is combined with a sync filter (even in online mode). The Android operating system limits the number of geofenced records to 100.
To troubleshoot problems with geofencing configuration, start with enabling more detailed logging:
- Edit geofencing configuration.
- Set Log verbosity to "Diagnostic".
- Save the configuration and publish the app project.
After the next sync, devices start generating additional log entries. You can access them from the About window ("Send Log" button in the top right corner).
If a device doesn't show the "Arrived" notification when reaching the destination, the log may contain similar messages:
GeoFence source entity Work Order: 0 records" GeoFence inactive due to no source records.
If the configuration points to valid Work Order records, the log should contain the list of record IDs and information about geofence service activation.
If you encounter inactive geofencing due to 0 source records, verify that the configuration is correct.
- The expected records must match the filter specified in the geofencing setup. The filter is combined with the Sync Filter for Work Order entity.
- Moreover, the generated fetch XML request excludes records with empty latitude and longitude field values. These can be directly in the Work Order entity, or in a related entity (e.g., Account). Make sure that the correct latitude and longitude fields are selected in geofencing configuration.