cordova-plugin-gpsmockchecker

1.0.5 • Public • Published

cordova-plugin-gpsmockchecker

This is a cordova plugin to avoid mock locations.

This plugin get mock location in Android api <= 22 AND api > 22

You can choose a white list of packages.

Supported Platforms

  • Android API all versions

Installation

cordova plugin add cordova-plugin-gpsmockchecker

Usage in typescript / ionic

    this.platform.ready().then(() => {
 
      var whiteList = ['com.package.example','com.package.example2'];
 
      (<any>window).gpsmockchecker.check(whiteList, (result) => {
        
        console.log(result);
 
        if(result.isMock){
            console.log("DANGER!! Mock is in use");
            console.log("Apps that use gps mock: ");
            console.log(result.mocks);
        }
        else
          console.log("All its ok");
  
  
      }, (error) => console.log(error));
      
    });

Usage in javascript

 
document.addEventListener("deviceready", onDeviceReady, false);
 
function onDeviceReady() {  
  var whiteList = ['com.package.example','com.package.example2'];
  mockchecker.check(whiteList, successCallback, errorCallback);
}
 
function successCallback(mockStatus) {
  console.log(mockStatus);
}
 
function errorCallback(error) {
  console.log(error);
}

mockStatus

Contains mock status :

properties

  • isMock : (boolean) true if device mock, false if no mock behavior detected.
  • mocks : (array) return APPs using mock.

Package Sidebar

Install

npm i cordova-plugin-gpsmockchecker

Weekly Downloads

65

Version

1.0.5

License

Apache-2.0

Unpacked Size

18.7 kB

Total Files

6

Last publish

Collaborators

  • sunflowerenergias