Blog

GPS - 3 Frequent Questions about Location Services

Help - my app isn't picking up correct location/GPS values! If the location features aren't working, it might be due to these reasons that I most commonly see.

The ability to retrieve the user location in a canvas app is a great feature that opens up many possibilities.

However, this feature can raise some questions and here are 3 that I commonly see.

1. The longitude or latitude values return nothing, or returns zero values 

The most common question is that the location signal does not a return value, or that it returns 0 longitude and latitude values. The typical cause of this is that the location signal is disabled.

Power Apps disables the location signal when it detects that it isn't in active use. This is good behaviour because it helps preserve the battery life of a mobile device. However, it can be very confusing when the location signal stops working as expected.

The fix for this is to to re-enable the location signal on the screen where we want to retrieve location values. We can do this by calling the Enable function in the OnVisible property of the screen like so.

Enable(Location)
The help for the Enable function is here:

2. The longitude or latitude values are not accurate

A second common question issue relates to the accuracy of the location readings. App builders sometimes report that the location readings are not as accurate as they expect.

Usually, the reason for this is because the settings of the device have not been set up to return location readings with "high accuracy".

On an Android device for example, we can fix this through the Settings > Location menu item. Here, we can find the settings that determine the accuracy of the location that the device returns.


3. Can I build an app that tracks the activity of a user?

The third frequent question I see is more of a general question. App builders often ask whether it's possible to build an app that tracks the activity of users. For example, an app that can track the location of a delivery driver throughout the day, or a health-related app that can track the time and route of a run.

In practice, Power Apps is not well-suited for these use case scenarios. The reason for this is because it can only capture location data when the app runs in the foreground. When a device becomes inactive and the screen switches off, the app suspends execution and will not collect data whilst in this state.

Conclusion

Power Apps offers good location and GPS support and in this post, we covered three frequent questions that relate to this feature.