I want to show an alert saying that \"Please turn on your GPS\".
How can I get GPS status using phonegap?
I have used following code but I don\'t get any alert m
The answer to your question is below.
You cannot check *if gps is enabled*
You can set a timeout and get the timeout.
You can do this by setting the timeout
parameter in the geolocationoptions parameter. (which you did not use)
From the documentation
navigator.geolocation.getCurrentPosition
or geolocation.watchPosition
until the corresponding geolocationSuccess
callback executes. If the geolocationSuccess
callback is not invoked within this time, the geolocationError
callback is passed a PositionError.TIMEOUT
error code. (Note that when used in conjunction with geolocation.watchPosition
, the geolocationError
callback could be called on an interval every timeout
milliseconds!) (Number)There is now a plugin that checks to see if the GPS is turned on.
In fact, more than one.