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?
No comments:
Post a Comment