1

I want check whether GPS enabled or disabled in phonegap.

and display an alert when the GPS status changed

I have done this in android.

NARESH REDDY
  • 682
  • 4
  • 11

1 Answers1

1

From the phonegap docs

var watchId = navigator.geolocation.watchPosition(geolocationSuccess,
                                              [geolocationError],
                                              [geolocationOptions]);

You might want to do something like this(untested)

navigator.geolocation.watchPosition(function(position) {
    alert(position.coords.latitude) //or logitude and etc
});

and if you want to stop watching

geolocation.clearWatch

Have a look at this or this, could be helpful.

Community
  • 1
  • 1
bhb
  • 2,476
  • 3
  • 17
  • 32