开始入门
复制一个包含安装步骤和此插件的完整 Markdown 指南的配置提示。
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.
安装
标题为“安装”您可以使用我们的 AI 助手来安装插件。将 Capgo 技能添加到您的 AI 工具中,使用以下命令:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins然后使用以下提示:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-proximity` plugin in my project.如果您更喜欢手动设置,请运行以下命令安装插件并按照以下平台特定的说明:
bun add @capgo/capacitor-proximitybunx cap sync导入
标题:导入import { CapacitorProximity } from '@capgo/capacitor-proximity';API 概述
标题:API 概述enable
标题:启用启用附近监测.
在 iOS 上,这会启用 UIDevice.isProximityMonitoringEnabled.
在 Android 上,这会开始监听 TYPE_PROXIMITY 并在传感器被遮盖时降低当前
应用程序窗口的亮度.
import { CapacitorProximity } from '@capgo/capacitor-proximity';
await CapacitorProximity.enable();disable
标题为“disable”的部分禁用近距离监控.
这会恢复默认的应用程序窗口行为并停止传感器监控.
import { CapacitorProximity } from '@capgo/capacitor-proximity';
await CapacitorProximity.disable();getStatus
标题为“getStatus”的部分获取当前传感器可用性和插件启用状态.
import { CapacitorProximity } from '@capgo/capacitor-proximity';
const status = await CapacitorProximity.getStatus();ProximityStatusResult
“ProximityStatusResult”由 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
“PluginVersionResult”请求插件版本时返回的结果。
export interface PluginVersionResult { /** * Native plugin version string. * * @since 0.0.1 */ version: string;}真实数据来源
“真实数据来源”本页是由插件的 src/definitions.ts当公共API上游发生变化时,请重新运行同步。
从开始
“从开始”如果您正在使用 开始使用 为计划仪表板和API操作连接它 使用@capgo/capacitor-proximity 在使用@capgo/capacitor-proximity中 API概述 在API概述中了解实现细节 介绍 在介绍中了解实现细节 API密钥 在API密钥中了解实现细节,并 设备 __CAPGO_KEEP_0__