SDK behavior on App States¶
The Pointr SDK has the ability to adapt to 3 states of the app it is integrated with. (Foreground - Background - Terminated). In this section, the BLE positioning, GPS positioning, and GPS Geofencing will be taken into account.
In Foreground, everything works as expected without any modification to the default configuration
BACKGROUND STATE
In Background, for the positioning to continue, the integrator should enable background positioning from the configuration. With the following parameter added to the integrators Pointr Cloud;
positionManagerConfiguration_isBackgroundPositioningEnabled
However, on Android, in light of the background limitations after Oreo, for the devices after Oreo, if the integrator wants to continue BLE positioning, it needs to start Pointr as a Foreground service. The integrator might see some position logs the first 5-10mins after the app is in the background even when Pointr is started regularly, but this will cease after a certain time. Also, appropriate permissions need to be added to the application’s AndroidManifest to utilize Foreground Services. For GPS tracking and GPS Geofencing, the integrator does not need to start Pointr as foreground service but would receive the GPS callbacks from Pointr SDK, keeping in mind the integrated app needs to handle the background limitations for Oreo+ devices. The configuration parameters to enable GPS geofencing and GPS tracking are :
positionManagerConfiguration_isGpsTrackingEnabled
geofenceManagerConfiguration_isGpsGeofencingEnabled
TERMINATED STATE
When the app is terminated, on Android, the BLE tracking will continue to work if Pointr is started as Foreground service and appropriate permissions are given. For GPS tracking and GPS geofencing, the Pointr SDK will wake up and respawn the process once a Geofence is triggered or a GPS position is calculated through its internal Broadcast Receiver, and fire the callback. Again the integrated app should handle this wake up gracefully for this callback to matter.
BACKGROUND STATE
In order to get information about the user’s positioning in the background, the following must be configured on the host application side: Regarding the user’s permission, the application Info.plist file should contain the description for the NSLocationAlwaysAndWhenInUseUsageDescription
key and in case the app supports iOS 10, the NSLocationAlwaysUsageDescription
key as well. Select Location Updates
in Background Modes
section of Signing & Capabilities
tab of the app’s target (not required for GPS geofencing) Background tracking requires the following parameters to be set on Pointr Cloud:
For Beacon Tracking
positionManagerConfiguration_isBackgroundPositioningEnabled
For GPS tracking and geofencing
positionManagerConfiguration_isGpsTrackingEnabledInBackground
For GPS geofencing
geofenceManagerConfiguration_isGpsGeofencingEnabled
TERMINATED STATE
The configuration for this state is the same as the one for the background state.