Démarrage
Copier un prompt de configuration avec les étapes d'installation et la guide markdown complète 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-proximity`
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/proximity/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 « Installer »bun add @capgo/capacitor-proximitybunx cap syncImporter
Section intitulée « Importer »import { CapacitorProximity } from '@capgo/capacitor-proximity';API Vue d'ensemble
Section intitulée « API Vue d'ensemble »Activer la surveillance de proximité.
Sur iOS, cela active UIDevice.isProximityMonitoringEnabled.
Sur Android, cela commence à écouter TYPE_PROXIMITY et diminue l'application actuelle
fenêtre pendant que le capteur est recouvert.
import { CapacitorProximity } from '@capgo/capacitor-proximity';
await CapacitorProximity.enable();Désactiver la surveillance de proximité.
Cette fonctionnalité restaure le comportement de fenêtre d'application par défaut et arrête la surveillance des capteurs.
import { CapacitorProximity } from '@capgo/capacitor-proximity';
await CapacitorProximity.disable();getStatus
Section intitulée “getStatus”Obtenir l'état actuel de disponibilité des capteurs et d'activation du plugin.
import { CapacitorProximity } from '@capgo/capacitor-proximity';
const status = await CapacitorProximity.getStatus();Référence de type
Section intitulée “Référence de type”ProximityStatusResult
Section intitulée “ProximityStatusResult”Résultat retourné par getStatus().
export interface ProximityStatusResult { /** * Whether the current device exposes a usable proximity sensor. * * @since 0.0.1 */ available: boolean;
/** * Whether proximity monitoring is currently enabled by the plugin. * * @since 0.0.1 */ enabled: boolean;
/** * Platform label returned by the native or web implementation. * * @since 0.0.1 */ platform: 'ios' | 'android' | 'web';}PluginVersionResult
Section intitulée “PluginVersionResult”Résultat retourné lors de la demande de la version du plugin.
export interface PluginVersionResult { /** * Native plugin version string. * * @since 0.0.1 */ version: string;}Source De Vérité
Section intitulée “Source De Vérité”Cette page est générée à partir du plugin’s src/definitions.tsRe-run la synchronisation lorsque les public API changent en amont.
Continuez de Getting Started
Section intitulée “Continuez de Getting Started”Si vous utilisez Getting Started pour planifier les opérations de tableau de bord et API , connectez-le avec En utilisant @capgo/capacitor-proximité pour la capacité native en utilisant @capgo/capacitor-proximité, Vue d'ensemble de API pour le détail d'implémentation dans Vue d'ensemble de API, Introduction pour le détail d'implémentation dans Introduction, Clés de API pour le détail d'implémentation dans Clés de API, et Appareils pour le détail d'implémentation dans Appareils.