cordova-mock-geolocation-plugin

1.0.4 • Public • Published

MIT license

Tested on: Android 4.4.2, 5.0, 5.1.1, 6.0, 6.0.1, 7.0

Cordova Mock Geolocation Plugin

Plugin that mocks geolocation into Android device, e.g. from external GPS Bluetooth device. Plugin has been tested on Android 4.4.2 and Android 6.0

Using

Install the plugin:

$ cordova plugin add https://github.com/ArcGEO/cordova-mock-geolocation-plugin.git   

In your cordova application:

    var latitude = -26.902038;
    var longitude = -48.671337;
    var accuracy = 1;
    var altitude = 0;
    
    mockGeolocation.setMock([latitude, longitude, accuracy, altitude], function(suc){
          console.log(suc);
        }, function(err){
          console.log(err);
        });

Permissions

For Android Marshmellow, you need to allow your app to mock location (in developer tools).

Follow: Allow mock location on Android M

API

mockGeolocation.setMock([latitude, longitude, accuracy, altitude], successCallback, errorCallback)

Mocks input parameters as your device location.

TODO

  • Add more parameters
  • Add samples

Package Sidebar

Install

npm i cordova-mock-geolocation-plugin

Weekly Downloads

1

Version

1.0.4

License

MIT

Last publish

Collaborators

  • tomasvoj