Skip to content

Capacitor plugin for Android which checks if location is spoofed/mock/fake or MockProvider is enabled.

Notifications You must be signed in to change notification settings

Dreamlinerm/capacitor-check-ismock-location

Repository files navigation

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

About

Capacitor plugin for Android which checks if location is spoofed/mock/fake or MockProvider is enabled.

Resources

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published