Passer à la navigation

Prise en main

GitHub
Fenêtre de terminal
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 });

Les applications ne peuvent pas désactiver le mode développeur ou la localisation de simulation automatiquement. Ouvrez les paramètres à la place :

await MockLocationDetector.openDeveloperSettings();

Configuration du plateau

Configuration de la plateforme

Cette page suit les modifications du plugin. src/definitions.tsRe-générez docgen upstream lorsque le public API change.