I have a screen that uses Location, but when testing to see if the GPS is on, I've come across issues;
Firstly, please check my logic on the testing portion;
Here's the scenario:
User starts the App with GPS off.
When it comes to the screen that uses GPS, it detects that it's off and prompts the user to switch it on.
Here's the problem:
When the user enables GPS, (after starting the app) the app doesn't RE-check Location. It remains blank.
It doesn't update dynamically.
It doesn't update when I apply a Location.Latitude check on a button action.
It doesn't update when I navigate away from the screen and back again.
It only re-checks and successfully updates when I navigate away from the APP entirely (i.e. launch a different app window like a browser) - as soon as I come back the Location has been updated.
Once the Location has been updated, if I turn GPS OFF, it doesn't clear the Location. It retains the last entry no matter what I do.
This creates some sticky issues!
Can someone advise if this is in fact expected behaviour and/or perhaps some workarounds? Is there a way to force a location recheck, similar to what happens when the app goes into background/foreground state?
I test this issue on my side. With the GPS is OFF on my device, I open the app and the screen is just blank. Then I try to turn on the GPS, back to the app, the screen is still blank. I found that only when I re-open the app the location will be updated.
And also if I turn off the GPS, it doesn’t clear the location. Only when I re-open the app, it turns to be blank.
Thanks for reporting. I am confirming with this issue from my side, and I will back to you once I got any updates.
PGs are working on this issue. I guess that it would be fixed soon, but I don’t have a timeline.
I will back once I got any updates.
Thanks a mil - based on the behaviour I'm guessing Location is just a container that gets updated from an underlying call to location services (let's call it GPS to avoid confusion with the Location function in PowerApps) - so when you turn the underlying GPS service off, if the Location container had Latitude and Longitude values from a previously successful check, it wouldn't be overwritten with a blank value. Thus subsequent checks even after GPS is off yield the last saved value.
Probably not a bad thing for retaining 'last successful read', but there's got to be a better way of determining if GPS is on or off than just trying to pull a location out of it... 🙂
It looks like the initial check for GPS/Location Services is at the start of permission prompt for using Location, or the OnCreate and possibly also on the OnResume state of the PowerApps Android App?
For me, it updates when I cycle the app through a state change (Android OnResume state looks like the likely suspect).
I can do this by launching a browser window from the app and forcing the user to then switch back to the app. Not ideal, but fine for now I guess.
Will wait to see further updates - thanks 🙂
@joao_pires The only workaround I've found so far is to tell the user to put it on, then when they click a button to say they've put it on,
Launch("http://someurl"); Navigate("previous_screen", Transition.none)
This will put PowerApps in the background and launch the phone browser - The website can be some message with HTML5 that confirms their GPS is on, or I just use google maps - then when they return to powerapps and they navigate back to the screen using the GPS, PowerApps now reads it.
Fill out a quick form to claim your user group badge now!
Find out where you can attend!
Features releasing from October 2019 through March 2020
The largest Power BI, Power Platform, and Data conference in New Zealand