跳过内容

开始使用

GitHub
终端窗口
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 });

引导用户到设置

标题:引导用户到设置

应用程序无法自动禁用开发者模式或模拟位置。请打开设置:

await MockLocationDetector.openDeveloperSettings();

平台设置

平台设置

真实数据来源

真实数据来源

本页面遵循插件的 src/definitions.ts重新生成docgen上游文档时,公共API发生变化。