Zum Inhalt springen

Einstieg

Terminalfenster
bun add @capgo/capacitor-proximity
bunx cap sync
import { CapacitorProximity } from '@capgo/capacitor-proximity';

Proximitätsüberwachung aktivieren.

Bei iOS aktiviert dies UIDevice.isProximityMonitoringEnabledBei Android beginnt es, auf TYPE_PROXIMITY und dimmt die aktuelle Anwendungsansicht, während der Sensor abgedeckt ist.

import { CapacitorProximity } from '@capgo/capacitor-proximity';
await CapacitorProximity.enable();

Proximitätsüberwachung deaktivieren.

Dies setzt die Standardanwendungsansicht wieder her und beendet die Sensorüberwachung.

import { CapacitorProximity } from '@capgo/capacitor-proximity';
await CapacitorProximity.disable();

Ermitteln Sie den aktuellen Sensorverfügbarkeits- und Plugin-Status.

import { CapacitorProximity } from '@capgo/capacitor-proximity';
const status = await CapacitorProximity.getStatus();

Ermitteln Sie den Status 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';
}

Ermitteln Sie den Plugin-Version-Status.

export interface PluginVersionResult {
/**
* Native plugin version string.
*
* @since 0.0.1
*/
version: string;
}

Quelle der Wahrheit

Quelle der Wahrheit

Diese Seite wurde aus dem Plugin generiert. src/definitions.tsRe-run die Synchronisation, wenn die öffentliche API sich im Quellcode ändert.