Panduan Memulai
Copy prompt setup berisi langkah install dan panduan markdown lengkap untuk plugin ini.
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 syncimport { MockLocationDetector } from '@capgo/capacitor-mock-location-detector';Mulai cepat
Bagian berjudul “Mulai cepat”import { MockLocationDetector } from '@capgo/capacitor-mock-location-detector';
const result = await MockLocationDetector.getCapabilities();console.log(result);Contoh: analyze
Bagian berjudul “Contoh: analyze”import { MockLocationDetector } from '@capgo/capacitor-mock-location-detector';
const result = await MockLocationDetector.analyze();console.log(result);Contoh: runCheck
Bagian berjudul “Contoh: runCheck”import { MockLocationDetector } from '@capgo/capacitor-mock-location-detector';
const result = await MockLocationDetector.runCheck({ check: 'system_mock_flag' });console.log(result);Masalah umum
Bagian berjudul “Kesalahan umum”- Listeners: hapus handle saat screen unmount.
- Sinkronisasi native: jalankan
bunx cap syncsetelah upgrade plugin. - Sumber kebenaran: percaya
src/definitions.tspada repo GitHub.
Alur yang Direkomendasikan
Bagian berjudul “Alur yang Direkomendasikan”const result = await MockLocationDetector.analyze({ requestLocationSample: true, minDetectedChecks: 1,});
if (result.isSimulated) { console.warn('Possible GPS spoofing detected', result.riskScore, result.checks);}Jalankan Satu Pengecekan
Bagian berjudul “Jalankan Satu Pengecekan”const mockFlag = await MockLocationDetector.runCheck({ check: 'system_mock_flag',});Pantau Terus-menerus
Bagian berjudul “Pantau Terus-menerus”await MockLocationDetector.addListener('locationIntegrityChanged', (event) => { console.log('Integrity changed', event.confidence, event.checks);});
await MockLocationDetector.startMonitoring({ intervalMs: 30000 });Arahkan Pengguna ke Settings
Bagian berjudul “Arahkan Pengguna ke Settings”Aplikasi tidak bisa menonaktifkan developer mode atau mock location secara otomatis. Buka settings saja:
await MockLocationDetector.openDeveloperSettings();Setup Platform
Bagian berjudul “Setup Platform”- iOS: Setup iOS
- Android: Setup Android
Sumber Kebenaran
Bagian berjudul “Sumber Kebenaran”Halaman ini mengikuti src/definitions.tsplugin. Jalankan ulang docgen upstream jika API publik berubah.