@adobe/react-native-aepplaces

中文文档
7.0.1发布于 2025/05/19Apache-2.0TypeScriptCommonJS零依赖近 30 天下载 2.6万

Adobe Experience Platform support for React Native apps.

原始使用文档
文档目录6 节
  1. Peer Dependencies
  2. Installation
  3. Usage
  4. Initializing with SDK:
  5. Importing the extension:
  6. API reference

React Native AEP Places Extension

npm version npm downloads

@adobe/react-native-aepplaces is a wrapper around the iOS and Android Adobe Experience Platform Places Extension to allow for integration with React Native applications. Functionality to enable Adobe Places is provided entirely through JavaScript documented below.

Peer Dependencies

The Adobe Experience Platform Optimize extension has the following peer dependency, which must be installed prior to installing the optimize extension:

Installation

See Requirements and Installation instructions on the main page

Install the @adobe/react-native-aepplaces package:

NPM:

npm install @adobe/react-native-aepplaces

Yarn:

yarn add @adobe/react-native-aepplaces

Usage

Initializing with SDK:

To initialize the SDK, use the following methods:

Refer to the root Readme for more information about the SDK setup.

Importing the extension:

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

API reference

Getting the extension version:

Syntax

extensionVersion(): Promise<string>

Example

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

Get the nearby points of interest:

Syntax

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

Example

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}`
}

Process geofence:

Syntax

processGeofence(geofence, <transitionType>): void

Example

// 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);

Get the current point of interests:

Syntax

getCurrentPointsOfInterest(): Promise<Array<PlacesPOI>>

Example

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

Get the last known location

Syntax

getLastKnownLocation(): Promise<PlacesLocation>

Example

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

Clear

Syntax

clear(): void

Example

Places.clear();

Set Authorization status:

Syntax

setAuthorizationStatus(authStatus?: PlacesAuthStatus): void;

Example

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 共发布 12 个版本,首次发布于 2022/09/01;过去 12 个月发布了 0 个版本。

版本发布日期距今
7.0.1latest2025/05/191.5 年前
7.0.02025/03/291.6 年前
6.0.32025/01/141.8 年前
6.0.22024/06/072 年前
6.0.12024/04/242 年前
6.0.02024/04/132 年前

关于 @adobe/react-native-aepplaces 的常见问题

@adobe/react-native-aepplaces 是什么?

Adobe Experience Platform support for React Native apps.

如何安装 @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 和提交记录判断。