Démarrage
Copiez un prompt de configuration avec les étapes d'installation et le guide Markdown complet 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.
Installation
Section intitulée « Installation »Vous pouvez utiliser notre configuration assistée par l'IA pour installer le plugin. Ajoutez les Capgo compétences à votre outil IA à l'aide de la commande suivante :
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsUtilisez ensuite la prompt suivante :
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-proximity` plugin in my project.Si vous préférez la configuration manuelle, installez le plugin en exécutant les commandes suivantes et suivez les instructions spécifiques à la plateforme ci-dessous :
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 la fenêtre de l'application actuelle 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 la fenêtre d'application par défaut et arrête la surveillance du capteur.
import { CapacitorProximity } from '@capgo/capacitor-proximity';
await CapacitorProximity.disable();getStatus
Section intitulée “obtenir l'état”Obtenir la disponibilité actuelle du capteur et l'état de la mise en œuvre 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.ts. Re-run the sync when the public API changes upstream.
Continuez de Getting Started
Section intitulée « Continuez de Getting Started »If vous utilisez __CAPGO_KEEP_0__ Prise en main pour planifier le tableau de bord et les opérations API, connectez-le à Utilisation de @capgo/capacitor-proximité pour la capacité native dans l'utilisation de @capgo/capacitor-proximité, Vue d'ensemble de API pour les détails d'implémentation dans la Vue d'ensemble de API, Introduction pour les détails d'implémentation dans l'Introduction, Clés de API pour les détails d'implémentation dans les Clés de API, et Appareils pour les détails d'implémentation dans les appareils.