capacitor-check-ismock-location
v1.0.4
Published
Capacitor plugin for Android which checks if location is spoofed/mock/false or MockProvider is enabled.
Downloads
26
Readme
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 |