GPS plugin for android.
cordova plugin add https://github.com/mrameezraja/cordova-plugin-gps
- cordova.plugins.gps.getStatus
- cordova.plugins.gps.isEnabled
- cordova.plugins.gps.getCurrentLocation
cordova.plugins.gps.getStatus(function(gpsstats){
console.log(JSON.stringify(gpsstats));
}, function(error){
console.log(error);
})
Response fields:
- gpsEnabled
- gpsFix
- grade
- accuracy
cordova.plugins.gps.getCurrentLocation(function(position){
console.log(JSON.stringify(position));
}, function(error){
console.log(error);
})
cordova.plugins.gps.isEnabled(function(gpsisEnabled){
console.log("isEnabled: " + gpsisEnabled);
});
window.addEventListener('gps.enabled', function(){
});
window.addEventListener('gps.disabled', function(){
});
- Android