cordova-plugin-gps
v0.2.2
Published
This plugin allows to turn on the gps like Google Maps.
Downloads
23
Maintainers
Readme
Cordova Plugin Gps
This plugin allows to turn on the gps if that is disabled. If gps is disabled it will show a dialog: by press OK button the app will be able to turn on the GPS.
Platform Available
Only Android
Installation
Install it with npm.
npm i cordova-plugin-gps
How To Use
Simple Use
Call enableGps method in your js.
// Example of Use
cordova.plugins.cordovaplugingps.enableGps(function(enabled){
// User can press ok or not
if (enabled) {
alert("Gps enabled!");
} else {
alert("Gps disabled!");
}
}, function(err) {
alert('An error occurred: ' + err);
});
Force to active / Recursive Request
function requestGpsActivation () {
// Example of Use
cordova.plugins.cordovaplugingps.enableGps(function(enabled){
// User can press ok or not
if (enabled) {
alert("Gps enabled!");
} else {
requestGpsActivation();
}
}, function(err) {
alert('An error occurred: ' + err);
});
}
requestGpsActivation();
Author
Daniele Tulone