capacitor-check-ismock-location
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

capacitor-check-ismock-location

The Capacitor plugin finds out if a location is spoofed/mock/fake on android not yet ios.

Implemented the functions on https://stackoverflow.com/questions/6880232/disable-check-for-mock-location-prevent-gps-spoofing as a Capacitor plugin

Install

npm install capacitor-check-ismock-location
npx cap sync

Example

import { Location } from "capacitor-check-ismock-location";

...

const isMocked = await Location.isMocked();
alert('isMocked: ' + JSON.stringify(isMocked));
const isLastLocationMocked = await Location.isLastLocationMocked();
alert('isLastLocationMocked: ' + JSON.stringify(isLastLocationMocked));
const installedMockPermissionApps = await Location.installedMockPermissionApps();
alert('installedMockPermissionApps: ' + JSON.stringify(installedMockPermissionApps));
    

Add this to your app Manifest.xml

<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>

or,

<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
    tools:ignore="QueryAllPackagesPermission" />

API

isMocked()

isMocked() => Promise<ObjectWithBooleanValue>

Is the last location mocked or MockProvider is enabled. Returns false on error.

Returns: Promise<ObjectWithBooleanValue>

Since: 1.0.0


isLastLocationMocked()

isLastLocationMocked() => Promise<ObjectWithBooleanValue>

Is the last location mocked. Returns false on error.

Returns: Promise<ObjectWithBooleanValue>

Since: 1.0.0


installedMockPermissionApps()

installedMockPermissionApps() => Promise<ObjectWithBooleanValue>

Is MockProvider enabled. Returns false on error.

Returns: Promise<ObjectWithBooleanValue>

Since: 1.0.0


Interfaces

ObjectWithBooleanValue

Object with the value property that is a boolean. Returns false on error.

Prop Type
value boolean

Readme

Keywords

Package Sidebar

Install

npm i capacitor-check-ismock-location

Weekly Downloads

8

Version

1.0.4

License

MIT

Unpacked Size

27.4 kB

Total Files

25

Last publish

Collaborators

  • dreamliner