Zum Inhalt springen

Erste Schritte

GitHub
Terminalfenster
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);
  • Listener: Handles beim Unmounten von Screens entfernen.
  • Nativer Sync: ausführen bunx cap sync nach Plugin-Upgrades.
  • Single Source of Truth: Vertrauen src/definitions.ts im 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 });

Benutzer zu den Einstellungen leiten

Section titled “Guide Users To Settings”

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

await MockLocationDetector.openDeveloperSettings();

Diese Seite folgt dem Plugin- src/definitions.ts. Führe docgen upstream erneut aus, wenn sich die öffentliche API ändert.