@capgo/capacitor-mock-location-detector

June 23, 2026 ยท View on GitHub

Capgo - Instant updates for Capacitor

โžก๏ธ Get Instant updates for your App with Capgo

Missing a feature? Weโ€™ll build the plugin for you ๐Ÿ’ช

Detect simulated GPS locations using layered, App Store-safe checks on iOS and Android.

Snapshot

  • Plugin name: @capgo/capacitor-mock-location-detector
  • One-line value: Multi-layer GPS spoofing and developer tooling detection for Capacitor apps
  • Maintainer: Capgo
  • Status: beta

Problem & Scope

Why this plugin exists

Tools like PoKeep and iMyFone AnyTo can spoof device location. A single flag such as iOS isSimulatedBySoftware is not reliable against every spoofing method. This plugin combines multiple independent signals so your app can make better fraud-prevention decisions.

What it does

  • Runs layered checks: system mock flags, developer options, known mock apps, movement heuristics, and motion correlation
  • Returns a scored LocationIntegrityResult with per-check details
  • Supports continuous monitoring with locationIntegrityChanged events
  • Opens the best-effort settings screen so users can disable developer/mock tooling themselves

What it does not do

  • Cannot programmatically disable Developer Mode or mock location settings (not allowed by iOS/Android)
  • Cannot guarantee 100% detection against every future spoofing tool
  • On iOS, Apple provides no public API to read the Developer Mode toggle directly

Compatibility

Plugin versionCapacitor compatibilityMaintained
v8.*.*v8.*.*โœ…
v7.*.*v7.*.*On demand
v6.*.*v6.*.*On demand

Install

npm install @capgo/capacitor-mock-location-detector
npx cap sync

Setup

iOS

Add location usage descriptions to your app Info.plist:

<key>NSLocationWhenInUseUsageDescription</key>
<string>We verify your location has not been spoofed.</string>

Optional: declare URL schemes for companion spoof apps you want to detect:

<key>LSApplicationQueriesSchemes</key>
<array>
  <string>anyto</string>
  <string>fakegps</string>
</array>

Android

Ensure your app requests runtime location permissions. The plugin declares coarse/fine location permissions in its manifest merge.

Usage

import { MockLocationDetector } from '@capgo/capacitor-mock-location-detector';

const result = await MockLocationDetector.analyze({
  requestLocationSample: true,
  minDetectedChecks: 1,
});

if (result.isSimulated) {
  console.warn('Possible GPS spoofing detected', result.checks);
}

// Guide the user โ€” apps cannot disable developer mode automatically
await MockLocationDetector.openDeveloperSettings();

Run a single check layer:

const mockFlag = await MockLocationDetector.runCheck({
  check: 'system_mock_flag',
});

Start monitoring:

await MockLocationDetector.addListener('locationIntegrityChanged', (event) => {
  console.log('Integrity changed', event.riskScore, event.checks);
});

await MockLocationDetector.startMonitoring({ intervalMs: 30000 });

Check layers

Check IDiOSAndroidDescription
system_mock_flagโœ…โœ…OS mock/simulation flag on the current location fix
developer_optionsโ€”โœ…Android developer options enabled
developer_mode_indicatorsโœ…โœ…Indirect developer/debug build heuristics
mock_location_appโœ…โœ…Known spoof app packages / URL schemes
adb_enabledโ€”โœ…USB debugging enabled
mock_provider_settingsโ€”โœ…Apps granted mock-location permission
location_anomalyโœ…โœ…Impossible movement speed / teleport heuristic
motion_correlationโœ…โ€”GPS movement without matching accelerometer activity
simulatorโœ…โœ…Simulator/emulator environment
  • Plugin docs URL: https://capgo.app/docs/plugins/mock-location-detector/
  • Website/docs repo: https://github.com/Cap-go/website

Detect simulated GPS locations and developer tooling that commonly enables spoofing apps.

This plugin combines multiple independent checks because no single OS flag is reliable against tools such as PoKeep or iMyFone AnyTo. On iOS, Apple does not provide a public API to read the Developer Mode toggle directly; the plugin uses App Store-safe heuristics instead.

Apps cannot programmatically disable Developer Mode or mock location settings. Use {@link MockLocationDetectorPlugin.openDeveloperSettings} to guide users to the relevant settings.

getCapabilities()

getCapabilities() => Promise<MockLocationDetectorCapabilities>

Returns: Promise<MockLocationDetectorCapabilities>


analyze(...)

analyze(options?: AnalyzeOptions | undefined) => Promise<LocationIntegrityResult>
ParamType
optionsAnalyzeOptions

Returns: Promise<LocationIntegrityResult>


runCheck(...)

runCheck(options: RunCheckOptions) => Promise<LocationCheckResult>
ParamType
optionsRunCheckOptions

Returns: Promise<LocationCheckResult>


openDeveloperSettings()

openDeveloperSettings() => Promise<void>

startMonitoring(...)

startMonitoring(options?: MonitoringOptions | undefined) => Promise<void>

Start background integrity monitoring on native platforms.

Pair with {@link MockLocationDetectorPlugin.addListener} to receive locationIntegrityChanged events while the app is in the foreground.

ParamType
optionsMonitoringOptions

stopMonitoring()

stopMonitoring() => Promise<void>

Stop monitoring and release native location listeners.


addListener('locationIntegrityChanged', ...)

addListener(eventName: 'locationIntegrityChanged', listenerFunc: (event: LocationIntegrityChangedEvent) => void) => Promise<PluginListenerHandle>

Listen for integrity updates while {@link MockLocationDetectorPlugin.startMonitoring} is active.

ParamTypeDescription
eventName'locationIntegrityChanged'Must be 'locationIntegrityChanged'.
listenerFunc(event: LocationIntegrityChangedEvent) => void

Returns: Promise<PluginListenerHandle>


getPluginVersion()

getPluginVersion() => Promise<PluginVersionResult>

Returns: Promise<PluginVersionResult>


Interfaces

MockLocationDetectorCapabilities

PropType
platformLocationIntegrityPlatform
availableChecksLocationCheckId[]
supportsMonitoringboolean
canOpenDeveloperSettingsboolean

LocationIntegrityResult

PropType
isSimulatedboolean
confidenceLocationIntegrityConfidence
riskScorenumber
platformLocationIntegrityPlatform
checksLocationCheckResult[]
developerModeDeveloperModeResult
locationSampleLocationSample | null
recommendationstring

LocationCheckResult

PropType
idLocationCheckId
namestring
platformLocationIntegrityPlatform
availableboolean
detectedboolean
messagestring
metadata{ [key: string]: unknown; }

DeveloperModeResult

PropType
detectedboolean
canDetectDeveloperModeboolean
checksLocationCheckResult[]

LocationSample

PropType
latitudenumber
longitudenumber
accuracynumber
altitudenumber
speednumber
timestampnumber

AnalyzeOptions

PropType
checksLocationCheckId[]
requestLocationSampleboolean
locationTimeoutMsnumber
minDetectedChecksnumber
additionalMockAppPackagesstring[]
additionalMockAppUrlSchemesstring[]

RunCheckOptions

PropType
checkLocationCheckId

MonitoringOptions

PropTypeDescriptionDefault
intervalMsnumberHow often to re-run checks while monitoring is active. Minimum 5000 ms. Defaults to 30000.30000
emitOnlyOnChangebooleanWhen true, locationIntegrityChanged is emitted only when isSimulated, confidence, riskScore, or triggered check IDs change. The first event after {@link MockLocationDetectorPlugin.startMonitoring} always fires.true

PluginListenerHandle

PropType
remove() => Promise<void>

LocationIntegrityChangedEvent

Payload emitted by {@link MockLocationDetectorPlugin.addListener} when monitoring detects a new integrity snapshot.

Register the listener before calling {@link MockLocationDetectorPlugin.startMonitoring}:

PropTypeDescription
reason'interval' | 'location_update' | 'manual'Why this snapshot was emitted. - manual โ€” first snapshot right after monitoring starts - interval โ€” periodic re-check (intervalMs) - location_update โ€” device location changed while monitoring (native only)

PluginVersionResult

PropType
versionstring

Type Aliases

LocationIntegrityPlatform

'ios' | 'android' | 'web'

LocationCheckId

Individual integrity checks exposed by the plugin.

'system_mock_flag' | 'developer_options' | 'developer_mode_indicators' | 'mock_location_app' | 'adb_enabled' | 'mock_provider_settings' | 'location_anomaly' | 'motion_correlation' | 'simulator'

LocationIntegrityConfidence

'none' | 'low' | 'medium' | 'high'