开始使用
复制一个包含安装步骤和本插件的完整Markdown指南的设置提示。
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.
安装
标题:安装bun add @capgo/capacitor-mock-location-detectorbunx 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发生变化。