I am using PositionSource to get the latitude and longitude of the user's location from the GPS data provided by Ubuntu Touch. However I need to detect if GPS has been enabled by the user.
On reading through the official documentation for PositionSource here, I found that it has the property valid which quoting the official docs says,
This property is true if the PositionSource object has acquired a valid backend plugin to provide data. If false, other methods on the PositionSource will have no effect.
Applications should check this property to determine whether positioning is available and enabled on the runtime platform, and react accordingly.
However this property doesn't seem to update when I enable/disable the location service in Ubuntu Touch. I tried changing the GPS status both using the GUI (location indicator) and from the command line by,
stop ubuntu-location-service-trust-stored
Is there any other property I can track to check whether GPS is enabled/disabled on the phone?
Applications should not rely on knowledge about the actual positioning provider but instead rely on the accuracy estimates provided with individual position updates (see http://developer.ubuntu.com/api/qml/sdk-14.10/QtLocation.Position/#horizontalAccuracy-prop). With that, application developers do not need to worry about specific characteristics of satellite-based positioning systems (e.g., GPS, GLONASS, Beidou) and instead focus on the task at hand.
More to that, the location subsystem in Ubuntu might not even use GPS for providing position estimates but instead solely rely on network-based positioning.