Prise en main
Copiez un prompt de configuration incluant les étapes d'installation et le guide markdown complet pour ce 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.
Installer
Section intitulée « Installation »bun add @capgo/capacitor-mock-location-detectorbunx cap syncImporter
Section intitulée « Import »import { MockLocationDetector } from '@capgo/capacitor-mock-location-detector';Démarrage rapide
Section intitulée « Démarrage rapide »import { MockLocationDetector } from '@capgo/capacitor-mock-location-detector';
const result = await MockLocationDetector.getCapabilities();console.log(result);Exemple : analyse
Section intitulée « Exemple : analyse »import { MockLocationDetector } from '@capgo/capacitor-mock-location-detector';
const result = await MockLocationDetector.analyze();console.log(result);Exemple : runCheck
Section intitulée « Exemple : runCheck »import { MockLocationDetector } from '@capgo/capacitor-mock-location-detector';
const result = await MockLocationDetector.runCheck({ check: 'system_mock_flag' });console.log(result);Erreurs courantes
Section intitulée « Erreurs courantes »- Écouteurs: supprimez les handles lors du démontage des écrans.
- Sync native : exécuter
bunx cap syncaprès les mises à jour du plugin. - Source de vérité : fiez-vous
src/definitions.tsau repo GitHub.
Flux recommandé
Section intitulée « Flux recommandé »const result = await MockLocationDetector.analyze({ requestLocationSample: true, minDetectedChecks: 1,});
if (result.isSimulated) { console.warn('Possible GPS spoofing detected', result.riskScore, result.checks);}Lancer une vérification
Section intitulée « Lancer une vérification »const mockFlag = await MockLocationDetector.runCheck({ check: 'system_mock_flag',});Surveiller en continu
Section intitulée « Surveiller en continu »await MockLocationDetector.addListener('locationIntegrityChanged', (event) => { console.log('Integrity changed', event.confidence, event.checks);});
await MockLocationDetector.startMonitoring({ intervalMs: 30000 });Guider les utilisateurs vers les réglages
Section titled “Guide Users To Settings”Les apps ne peuvent pas désactiver automatiquement le mode développeur ni la position simulée. Ouvrez plutôt les réglages :
await MockLocationDetector.openDeveloperSettings();Configuration de la plateforme
Section intitulée « Configuration de la plateforme »- iOS : Configuration iOS
- Android : Configuration Android
Source de vérité
Section intitulée « Source de vérité »Cette page suit celle du plugin src/definitions.ts. Relancez docgen en amont lorsque l’API public change.