# @adobe/react-native-aepplaces 中文文档

规范地址：https://npmcn.com/package/%40adobe/react-native-aepplaces/

版本：7\.0\.1
npm 元数据更新时间：2026-10-01T01:34:10.051Z
中文译文更新时间：2026-11-05T20:35:58.557Z
软件包许可：Apache-2\.0

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40adobe/react-native-aepplaces
原文对照：https://npmcn.com/package/%40adobe/react-native-aepplaces/?lang=original
项目主页：https://developer.adobe.com/client-sdks/documentation/
源码仓库：https://github.com/adobe/aepsdk-react-native

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：91.1 kB，44 个文件
- 模块格式：CommonJS
- TypeScript 类型：包内自带
- 运行依赖：0 个
- peer 依赖：react-native \>=0\.60\.0，@adobe/react-native-aepcore ^7\.0\.0
- 首次发布：2022-08-31T16:22:53.262Z
- 最新版本发布：2025-05-19T10:06:29.679Z
- 近 30 天下载量：25653（2026-10-05 至 2026-11-03，npm 官方下载统计）
- 已发布版本数：12（近 12 个月 0 个）

## 中文简介

Adobe体验平台支持回放原生应用程序.

## 安装

```sh
npm install @adobe/react-native-aepplaces
```

也可以使用：`pnpm add @adobe/react-native-aepplaces`、`yarn add @adobe/react-native-aepplaces`、`bun add @adobe/react-native-aepplaces`

## README

# 反应原生 AEP 位置扩展

[![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepplaces.svg)](https://www.npmjs.com/package/@adobe/react-native-aepplaces) [![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepplaces)](https://www.npmjs.com/package/@adobe/react-native-aepplaces)

`@adobe/react-native-aepplaces` 是iOS和Android周围的包装器 [Adobe 体验平台扩展](https://developer.adobe.com/client-sdks/documentation/places) 允许与 React Industrial 应用程序融合。 启用Adobe Places的功能完全通过下面所记录的JavaScript提供.

## 同伴依赖关系

Adobe体验平台优化扩展有以下对等依赖性,在安装优化扩展前必须安装: 1

-   [核心](https://npmcn.com/package/%40adobe/core/README.md)
-   [边缘](https://npmcn.com/package/%40adobe/edge/README.md)

## 安装

见 [所需经费和安装](https://github.com/adobe/aepsdk-react-native#requirements) 主页上的指令

安装 `@adobe/react-native-aepplaces` 软件包 :

国家预防机制:

```bash
npm install @adobe/react-native-aepplaces
```

亚伦:

```bash
yarn add @adobe/react-native-aepplaces
```

## 使用量

### 以 SDK 初始化 :

要初始化SDK,使用以下方法: 1

-   [Mobile Core. 初始化With AppId( 应用程序) (d) 国家](https://github.com/adobe/aepsdk-react-native/tree/main/packages/core#initializewithappid)
-   [Mobile Core. 初始化( 最小选项)](https://github.com/adobe/aepsdk-react-native/tree/main/packages/core#initialize)

参考根 [读取](https://github.com/adobe/aepsdk-react-native/blob/main/README.md) 关于SDK设置的更多信息.

### 导入扩展名 :

```typescript
import {
  Places,
  PlacesAuthStatus,
  PlacesGeofence,
  PlacesGeofenceTransitionType,
  PlacesLocation,
  PlacesPOI,
} from "@adobe/react-native-aepplaces";
```

## API 参考

#### 获取扩展版本 :

**语法**

```typescript
extensionVersion(): Promise<string>
```

**示例**

```typescript
const version = await Places.extensionVersion();
console.log(`AdobeExperienceSDK: Places version: ${version}`);
```

#### 获取附近关注点:

**语法**

```typescript
getNearbyPointsOfInterest(location, <limit>): Promise<Array<PlacesPOI>>
```

**示例**

```typescript
let location = new PlacesLocation(<latitude>, <longitude>, <optional altitude>, <optional speed>, <optional accuracy>);

try {
  const pois = await Places.getNearbyPointsOfInterest(location, <limit>);
  console.log(`AdobeExperienceSDK: Places pois: ${pois}`)
} catch(error) {
  console.log(`AdobeExperienceSDK: Places error: ${error}`
}
```

#### 过程地缘:

**语法**

```typescript
processGeofence(geofence, <transitionType>): void
```

**示例**

```typescript
// create a geofence
let geofence = new PlacesGeofence("geofence Identifier", <latitude>, <longitude>, <radius>, <optional expiration-duration>);
Places.processGeofence(geofence, PlacesGeofenceTransitionType.ENTER);
Places.processGeofence(geofence, PlacesGeofenceTransitionType.EXIT);
```

#### 获取当前利益点 :

**语法**

```typescript
getCurrentPointsOfInterest(): Promise<Array<PlacesPOI>>
```

**示例**

```typescript
const pois = await Places.getCurrentPointsOfInterest();
console.log('AdobeExperienceSDK: Places pois: ' + pois);
);
```

#### 获取最后已知位置

**语法**

```typescript
getLastKnownLocation(): Promise<PlacesLocation>
```

**示例**

```typescript
const location = await Places.getLastKnownLocation();
console.log('AdobeExperienceSDK: Places location: ' + location)
);
```

#### 清除

**语法**

```typescript
clear(): void
```

**示例**

```typescript
Places.clear();
```

#### 设定授权状态 :

**语法**

```typescript
setAuthorizationStatus(authStatus?: PlacesAuthStatus): void;
```

**示例**

```typescript
Places.setAuthorizationStatus(PlacesAuthStatus.ALWAYS);
Places.setAuthorizationStatus(PlacesAuthStatus.DENIED);
Places.setAuthorizationStatus(PlacesAuthStatus.RESTRICTED);
Places.setAuthorizationStatus(PlacesAuthStatus.WHEN_IN_USE);
Places.setAuthorizationStatus(PlacesAuthStatus.UNKNOWN);
```

## 常见问题

### @adobe/react-native-aepplaces 是什么？

Adobe体验平台支持回放原生应用程序\.

### 如何安装 @adobe/react-native-aepplaces？

在项目目录运行 npm install @adobe/react-native-aepplaces，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：react-native（\>=0\.60\.0）、@adobe/react-native-aepcore（^7\.0\.0）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @adobe/react-native-aepplaces 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @adobe/react-native-aepplaces 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @adobe/react-native-aepplaces 可以商用吗？

@adobe/react-native-aepplaces 使用 Apache-2\.0 许可。宽松许可：允许商业使用、修改和再分发，并附带明确的专利授权；分发时需保留许可与 NOTICE 文件，修改过的文件要注明改动。以上为概括，不构成法律意见，请以许可原文为准。

### @adobe/react-native-aepplaces 的下载量有多少？

根据 npm 官方下载统计，@adobe/react-native-aepplaces 在 2026/10/05 – 2026/11/03 这 30 天内被下载 25,653 次，日均约 855 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @adobe/react-native-aepplaces 还在维护吗？

最新版本 7\.0\.1 发布于 2025/05/19（1\.5 年前）；至今共发布 12 个版本，其中过去 12 个月发布了 0 个；首次发布于 2022/09/01。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

