Skip to content

Getting Started

GitHub
Terminal window
bun add @capgo/capacitor-mock-location-detector
bunx cap sync
import { MockLocationDetector } from '@capgo/capacitor-mock-location-detector';
import { MockLocationDetector } from '@capgo/capacitor-mock-location-detector';
const result = await MockLocationDetector.getCapabilities();
console.log(result);
import { MockLocationDetector } from '@capgo/capacitor-mock-location-detector';
const result = await MockLocationDetector.analyze();
console.log(result);
import { MockLocationDetector } from '@capgo/capacitor-mock-location-detector';
const result = await MockLocationDetector.runCheck({ check: 'system_mock_flag' });
console.log(result);
  • Listeners: remove handles when screens unmount.
  • Native sync: run bunx cap sync after plugin upgrades.
  • Source of truth: trust src/definitions.ts in the GitHub repo.
const result = await MockLocationDetector.analyze({
requestLocationSample: true,
minDetectedChecks: 1,
});
if (result.isSimulated) {
console.warn('Possible GPS spoofing detected', result.riskScore, result.checks);
}
const mockFlag = await MockLocationDetector.runCheck({
check: 'system_mock_flag',
});
await MockLocationDetector.addListener('locationIntegrityChanged', (event) => {
console.log('Integrity changed', event.confidence, event.checks);
});
await MockLocationDetector.startMonitoring({ intervalMs: 30000 });

Apps cannot disable developer mode or mock location automatically. Open settings instead:

await MockLocationDetector.openDeveloperSettings();

This page follows the plugin’s src/definitions.ts. Re-run docgen upstream when the public API changes.