Zum Inhalt springen

Getting Started

GitHub

Sie können unsere AI-gestützte Einrichtung verwenden, um das Plugin zu installieren. Fügen Sie die Capgo Fähigkeiten Ihrem AI-Tool mit folgendem Befehl hinzu:

Auf die Zwischenablage kopieren
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

Verwenden Sie dann die folgende Anweisung:

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-proximity` plugin in my project.

If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:

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

Proximitätsüberwachung aktivieren.

Auf iOS aktiviert dies UIDevice.isProximityMonitoringEnabled. Auf Android beginnt das Abhören des TYPE_PROXIMITY und dimmt die aktuelle Anwendungsfenster, während der Sensor abgedeckt ist.

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

Proximitätserkennung deaktivieren.

Dies setzt die Standardverhalten der Anwendung und beendet die Sensorüberwachung.

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

Ermitteln Sie den aktuellen Sensorstatus und die Plugin-Einstellung.

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

Ergibt zurück 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';
}

Ergibt zurück, wenn die Pluginversion angefordert wird.

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

Diese Seite wird aus dem Plugin generiert. src/definitions.ts. Re-run the sync when the public API changes upstream.

Wenn Sie Capgo verwenden Getting Started" to plan dashboard and API operations, connect it with Verwenden Sie @capgo/capacitor-proximity für die native Fähigkeit in Verwenden Sie @capgo/capacitor-proximity, API Übersicht für die Implementierungsdetails in API Übersicht, Einführung für die Implementierungsdetails in Einführung, API Schlüssel für die Implementierungsdetails in API Schlüssel und Geräte zur Implementierungsdetail in Geräte.