跳过内容

Page/area: Capgo marketing website. Role: Website copy sentence. Seen in: component doc/SignupCta.astro, component Hero.astro. Message key `hero_subtitle_v2` (Hero Subtitle V2).

GitHub

安装

安装

您可以使用我们的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-proximity
bunx cap sync
import { CapacitorProximity } from '@capgo/capacitor-proximity';

API概述

API 简介

导入

在 iOS 上启用 UIDevice.isProximityMonitoringEnabledOn Android this starts listening to TYPE_PROXIMITY 并在传感器被遮盖时降低当前应用程序窗口的亮度。

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

disable

禁用

关闭近距离监控。

恢复默认应用窗口行为并停止传感器监控。

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

获取当前传感器可用性和插件启用状态。

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

类型参考

类型参考

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

context

插件版本结果

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

真实来源 src/definitions.ts重新同步时,应监测上游的公共API变动。

重新同步公共__CAPGO_KEEP_0__时,重新运行同步。

Section titled “继续 Getting Started”

如果您正在使用 开始使用 来规划仪表板和API操作,连接它与 使用@capgo/capacitor-proximity 为native能力在使用@capgo/capacitor-proximity API概述 为API概述的实现细节 介绍 为介绍的实现细节 API密钥 为API密钥的实现细节 设备 了解设备的实现细节。