はじめに
このプラグインのインストール手順とフルマークダウンガイドを含むセットアッププロンプトをコピーする。
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.
インストール
インストールbun add @capgo/capacitor-proximitybunx cap syncインポート
インポートimport { CapacitorProximity } from '@capgo/capacitor-proximity';API オーバービュー
API オーバービューenable
__CAPGO_KEEP_1__近接モニタリングを有効にします。iOSでは、この機能を有効にすると
iOSでは、この機能を有効にすると UIDevice.isProximityMonitoringEnabled.
Androidでこの機能は、センサーが覆われたときに
現在のアプリウィンドウを暗くします。 TYPE_PROXIMITY とりあえずコピー
import { CapacitorProximity } from '@capgo/capacitor-proximity';
await CapacitorProximity.enable();disable
近接モニタリングを無効にします。この機能は、デフォルトのアプリウィンドウの動作を復元し、センサー監視を停止します。
とりあえずコピー
import { CapacitorProximity } from '@capgo/capacitor-proximity';
await CapacitorProximity.disable();getStatus
現在のセンサー利用可能性とプラグイン有効化状態を取得します。とりあえずコピー
import { CapacitorProximity } from '@capgo/capacitor-proximity';
const status = await CapacitorProximity.getStatus();「Type Reference」セクション
. Androidでこの機能は、センサーが覆われたときに 現在のアプリウィンドウを暗くします。ProximityStatusResult
近接状態結果__CAPGO_KEEP_0__がアップストリームで変更された場合に再度同期する 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
プラグインバージョン結果プラグインバージョンを要求したときに返される結果
export interface PluginVersionResult { /** * Native plugin version string. * * @since 0.0.1 */ version: string;}真実の源
プラグインのこのページはプラグインの src/definitions.ts. Re-run the sync when the public API changes upstream.