How to configure the Significant Change Location Plugin
1st Step
On plugin module, open the extensibility configurations and change the accordingly with your preferences.
Adjust the version of "GOOGLE_PLAY_SERVICES_VERSION" and "ANDROID_SUPPORT_LIBRARY_VERSION" for the plugin be compatible with other plugins you have in your application.
Change the messages accordingly to your preferences on "ACTIVITY_RECOGNITION", "ALWAYS_USAGE_DESCRIPTION", "MOTION_USAGE_DESCRIPTION". These messages are displayed when the application requires permission to use the Device location.
2nd Step
Configure your plugin to send the locations tracked to an API. You must create a module to expose two API’s to receive the locations tracked by the plugin itself.
Your API’s can include headers and you can also change them in run time.
The first API will receive a single Location.
The second API will receive a list of Locations. The second API have the purpose to submit all the locations tracked when the device is on offline mode or exists an error to submit the locations to the first API.
Within each API make your own logic!
First API
Second API
3rd Step
Define your headers and request structure sent to API’s.
On Significant Change Location Plugin module change the JavaScript file on “StartTracking” action to support your API’s headers and response structure.
The PostTemplate configuration is the JSON structure sent to the API during the tracking. You can the values sent by following the available variables here:
Location parameter
Type
Description
id
Number
ID of location as stored in DB (or null)
provider
String
gps, network, passive or fused
locationProvider
location provider
time
UTC time of this fix, in milliseconds since January 1, 1970.
latitude
Latitude, in degrees.
longitude
Longitude, in degrees.
accuracy
Estimated accuracy of this location, in meters.
speed
Speed if it is available, in meters/second over ground.
altitude
Altitude if available, in meters above the WGS 84 reference ellipsoid.
bearing
Bearing, in degrees.
isFromMockProvider
Boolean
(android only) True if location was recorded by mock provider
mockLocationsEnabled
(android only) True if device has mock locations enabled
4th Step
Tracking configurations.
To start tracking the device you must call the Action “StartTracking” on your code and set a group of configurations. These configurations can be adjusted by you.
NOTE: It is really important to configure the Notification structure in order the plugin run on Android devices. The Notification structure have the purpose to indicate the users that the device is being tracked.
5th Step
The current version of the plugin available on forge have Demo application where you can see an example and to configure and use the plugin.
https://www.outsystems.com/forge/component-overview/9502/significant-change-location-plugin