Erste Schritte
Kopiere einen Setup-Prompt mit den Installationsschritten und dem vollständigen Markdown-Guide für dieses Plugin.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-mock-location-detector`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/mock-location-detector/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
Installieren
Abschnitt „Installation“bun add @capgo/capacitor-mock-location-detectorbunx cap syncImportieren
Abschnitt mit dem Titel „Import“import { MockLocationDetector } from '@capgo/capacitor-mock-location-detector';Quickstart
Abschnitt „Quick start“import { MockLocationDetector } from '@capgo/capacitor-mock-location-detector';
const result = await MockLocationDetector.getCapabilities();console.log(result);Beispiel: analyze
Abschnitt mit dem Titel „Beispiel: analyze“import { MockLocationDetector } from '@capgo/capacitor-mock-location-detector';
const result = await MockLocationDetector.analyze();console.log(result);Beispiel: runCheck
Abschnitt mit dem Titel „Beispiel: runCheck“import { MockLocationDetector } from '@capgo/capacitor-mock-location-detector';
const result = await MockLocationDetector.runCheck({ check: 'system_mock_flag' });console.log(result);Häufige Stolperfallen
Abschnitt „Häufige Fallstricke“- Listener: Handles beim Unmounten von Screens entfernen.
- Nativer Sync: ausführen
bunx cap syncnach Plugin-Upgrades. - Single Source of Truth: Vertrauen
src/definitions.tsim GitHub Repo.
Empfohlener Ablauf
Abschnitt mit dem Titel „Empfohlener Ablauf“const result = await MockLocationDetector.analyze({ requestLocationSample: true, minDetectedChecks: 1,});
if (result.isSimulated) { console.warn('Possible GPS spoofing detected', result.riskScore, result.checks);}Einzelne Prüfung ausführen
Abschnitt mit dem Titel „Einzelne Prüfung ausführen“const mockFlag = await MockLocationDetector.runCheck({ check: 'system_mock_flag',});Kontinuierlich überwachen
Abschnitt mit dem Titel „Kontinuierlich überwachen“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();Plattform-Setup
Abschnitt mit dem Titel „Plattform-Einrichtung“- iOS: iOS-Setup
- Android: Android-Setup
Source of Truth
Abschnitt mit dem Titel „Source of Truth“Diese Seite folgt dem Plugin- src/definitions.ts. Führe docgen upstream erneut aus, wenn sich die öffentliche API ändert.