It is expected that the SDK will perform better when the app is in the foreground than when it is on the background. The SDK will receive more frequent location updates from the OS when the app is in the foreground than when it’s in the background.
This behaviour is similar for Android and iOS, but each OS has its own rules on giving location updates to the apps on foreground and background mode. To get the best performance of our SDK in the foreground and background, please follow these recommendations:
Android
We highly recommend implementing the Foreground Service to get the best performance of our SDK when the app is in the background. This method will allow the SDK to have location updates more frequently.
When using the Foreground Service, a notification will be displayed in the Notifications Tray, letting know the user that the app is having access to the location services. Once the SDK stops tracking the user, this notification will disappear.
For more information about the Foreground Service, check the developer’s documentation.
If you are using the React Native wrapper, you can use the setForegroundNotification method. Please refer to our React Native documentation for more information.
iOS
We recommend implementing the iOS SDK feature Blue Bar. It allows the SDK to have continuous access to the device’s location when the app is in the background, and the location permissions are While In Use.
For more information about Blue Bar please refer to our Developer’s Documentation.