I am using Location Plugin version 5.2.4 to track the user's position in my mobile app (Android and iOS). The tracking works fine when the app is open, but the "OnPositionChanged" event is not triggered when the app runs in the background (with the screen off). On iOS, the app has been granted "Always" location permission. However, I noticed that the "Always" option is not available on Android. Could you please clarify why this is happening? Thank you!
I have submitted a ticket to Outsystems support, and they have confirmed that the OnPositionChanged event of the plugin is designed to trigger only when the application is in the foreground. Therefore, it is expected that it will not function in the background.
Thank you.
Hi @Eden Yeo
Hope you added location tracker block and watch position action as well in the screen, This will help you to get the current location status update,
Kindly review below documentation for reference, still facing issue, please share Sample OML which is you tried.
Location Plugin:
https://success.outsystems.com/documentation/11/integration_with_external_systems/mobile_plugins/location_plugin/
Thanks
Murugan S S
Hi Murugan,
I've added the Location Tracker block and the Watch Position action. Tracking works fine when the app is open, but the "OnPositionChanged" event is not triggered when the app runs in the background with the screen off.
I've attached the OML file—please refer to the MovementTracker screen.
Hello @Eden Yeo
Basically Android kills background services to save battery, if that is the case, so you can request the IGNORE_BATTERY_OPTIMIZATIONS permission by adding this JSON to Extensibility Configurations:
{
"preferences": {
"android": [
"name": "android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS",
"value": "true"
}
]