35
Views
4
Comments
Solved
[Location Plugin] The LocationTracker is not running in the background.
Question
location-plugin
Mobile icon
Forge asset by OutSystems
Application Type
Mobile
Service Studio Version
11.54.86 (Build 63845)

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! 





Screenshot 2025-02-28 115909.png
property list keys.png
UserImage.jpg
Eden Yeo
Solution

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.

2023-01-25 05-43-21
Murugan S S

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

UserImage.jpg
Eden Yeo

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. 


Thank you.

HealthFitnessPluginDemoApp.oml
2024-07-12 05-57-50
Gourav Shrivastava
Champion

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"

      }

    ]

  }

}


UserImage.jpg
Eden Yeo
Solution

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.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.