Skip to content

Latest commit

 

History

History
executable file
·
89 lines (66 loc) · 1.27 KB

README.md

File metadata and controls

executable file
·
89 lines (66 loc) · 1.27 KB

GPS Plugin

GPS plugin for android.

Installation

cordova plugin add https://github.com/mrameezraja/cordova-plugin-gps

Methods

  • cordova.plugins.gps.getStatus
  • cordova.plugins.gps.isEnabled
  • cordova.plugins.gps.getCurrentLocation

cordova.plugins.gps.getStatus


  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


  cordova.plugins.gps.getCurrentLocation(function(position){
      console.log(JSON.stringify(position));
  }, function(error){
    console.log(error);
  })

cordova.plugins.gps.isEnabled


  cordova.plugins.gps.isEnabled(function(gpsisEnabled){
    console.log("isEnabled: " + gpsisEnabled);
  });

gps.enabled


  window.addEventListener('gps.enabled', function(){

  });

gps.disabled


  window.addEventListener('gps.disabled', function(){

  });

Supported Platforms

  • Android