Skip to content

Conversation

OS-pedrogustavobilro
Copy link
Contributor

@OS-pedrogustavobilro OS-pedrogustavobilro commented Sep 30, 2025

Description

This PR provides a new option enableLocationManagerFallback for using Android Framework's LocationManager, if for some reason using the Fused Provider from GMS is not possible (e.g. device without Play Services).

Also using the LocationManager with enableLocationManagerFallback=true when there's no network (e.g. device in Airplane mode). Even though Fused Provider technically could work without network (it would just use GPS), the location settings check fails - in this situation we use LocationManager with just GPS provider.

This PR contains BREAKING CHANGE: The constructor for the controller and some of its methods have changed signature.
Clients will need to change how your application calls the library if you update to this version.

Context

https://outsystemsrd.atlassian.net/browse/RMET-2991

Type of changes

  • Fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Refactor (cosmetic changes)
  • Breaking change (change that would cause existing functionality to not work as expected)

Tests

Use the following application, either from .apk file or build from source code (downloads may take a few seconds to start) - It's the Location Sample App From OutSystems O11 but with code from this PR in the native library.

Testing with airplane mode

If you set the device to airplane mode, it will use the LocationManager fallback.

Depending on what device you're testing, you may get location timeouts. This is because there is only GPS to access, which may be slower or in some cases only return a location when there's actual movement.

  • Try setting a higher timeout value, and to check that cached locations are still returned, try increasing maximum age.
  • For emulators - If you use the extended controls (three vertical dots), you'll be able to set new GPS coordinates, which should help in triggering new location updates.
  • For physical devices
    • On a Pixel I was able to trigger this fairly often by shaking the phone quickly
    • On another device I was only able to trigger updates when walking outside, so that GPS would update

Testing without Play Services

You may test with an emulator and AOSP image (without Play Store). Other than that I saw a "Huawei P40" on sauce labs, but it didn't have Petal Maps installed, the only way I found to properly trigger a new location was via the Sauce Labs Tools to mock a different device location.

Checklist

  • Pull request title follows the format RNMT-XXXX <title>
  • Code follows code style of this project
  • CHANGELOG.md file is correctly updated
  • Changes require an update to the documentation
    • Documentation has been updated accordingly

This fallback is used if IONGLOCLocationOptions#useLocationManagerFallback is true, and when there is an error in checking location settings / google play services.

BREAKING CHANGE: The constructor and some methods of `IONGLOCController` have changed signatures. Updating the library will require changes to fix compilation errors.
@OS-pedrogustavobilro OS-pedrogustavobilro self-assigned this Sep 30, 2025
@alexgerardojacinto
Copy link
Collaborator

Tested on Pixel 9 Pro XL (Android 16), Pixel 7 (Android 16), and Pixel 3 XL (Android 12) and it works properly. Using a timeout of 5 seconds I sometimes get a timeout, which is expected, but it still works most of the time - I'm able to get the location, both with GetLocation and WatchPosition.

@OS-pedrogustavobilro OS-pedrogustavobilro merged commit e820114 into main Oct 2, 2025
1 of 5 checks passed
@OS-pedrogustavobilro OS-pedrogustavobilro deleted the feature/RMET-2991/fallback branch October 2, 2025 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants