Getting Started
Copy a setup prompt with the install steps and the full markdown guide for this 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.
Install
Section titled “Install”bun add @capgo/capacitor-proximitybunx cap syncImport
Section titled “Import”import { CapacitorProximity } from '@capgo/capacitor-proximity';API Overview
Section titled “API Overview”enable
Section titled “enable”Enable proximity monitoring.
On iOS this enables UIDevice.isProximityMonitoringEnabled.
On Android this starts listening to TYPE_PROXIMITY and dims the current
app window while the sensor is covered.
import { CapacitorProximity } from '@capgo/capacitor-proximity';
await CapacitorProximity.enable();disable
Section titled “disable”Disable proximity monitoring.
This restores the default app window behavior and stops sensor monitoring.
import { CapacitorProximity } from '@capgo/capacitor-proximity';
await CapacitorProximity.disable();getStatus
Section titled “getStatus”Get the current sensor availability and plugin enabled state.
import { CapacitorProximity } from '@capgo/capacitor-proximity';
const status = await CapacitorProximity.getStatus();Type Reference
Section titled “Type Reference”ProximityStatusResult
Section titled “ProximityStatusResult”Result returned by 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 titled “PluginVersionResult”Result returned when requesting the plugin version.
export interface PluginVersionResult { /** * Native plugin version string. * * @since 0.0.1 */ version: string;}Source Of Truth
Section titled “Source Of Truth”This page is generated from the plugin’s src/definitions.ts. Re-run the sync when the public API changes upstream.