Amogh Talpallikar
Amogh Talpallikar

Reputation: 12184

How do I ask user to switch on the GPS of the device?

I am working on an Cordova application using ionic. I need user's coordinates for which I am using HTML5 geolocation API which does a graceful degradation if the best source isn't available. I have also added the cordova geolocation plugin that adds a global navigator object if not present. My app asks permission to use geolocation when I install the APK as well but it still gives me a location based on my network when my GPS is off.

I want to be able to ask user to switch on the GPS. How do I accomplish this. I am very new to HTML5 development for mobile.

Upvotes: 0

Views: 957

Answers (1)

shamon shamsudeen
shamon shamsudeen

Reputation: 5848

I think this will help you

https://github.com/mablack/cordova-diagnostic-plugin

I think the Geolocation API does not give you an error if the GPS is on/off, just a timeout error if it is not able to get a lock in the time limit you specify, but I tested it a while ago and I might be mistaking.

Upvotes: 1

Related Questions