Zum Inhalt springen

Einstieg

GitHub
Terminalfenster
bun add @capgo/capacitor-mock-location-detector
bunx cap sync
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.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 können den Entwicklermodus oder die Mock-Lokation nicht automatisch deaktivieren. Öffnen Sie stattdessen die Einstellungen:

await MockLocationDetector.openDeveloperSettings();

Diese Seite folgt den Anweisungen des Plugins src/definitions.tsRe-run docgen upstream, wenn die öffentliche API geändert wird.