@adobe/react-native-aepplaces

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

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

中文使用文档
文档目录6 节
  1. 同伴依赖关系
  2. 安装
  3. 使用量
  4. 以 SDK 初始化 :
  5. 导入扩展名 :
  6. API 参考

反应原生 AEP 位置扩展

npm version npm downloads

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

同伴依赖关系

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

安装

见 所需经费和安装 主页上的指令

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

国家预防机制:

npm install @adobe/react-native-aepplaces

亚伦:

yarn add @adobe/react-native-aepplaces

使用量

以 SDK 初始化 :

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

参考根 读取 关于SDK设置的更多信息.

导入扩展名 :

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

API 参考

获取扩展版本 :

语法

extensionVersion(): Promise<string>

示例

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

获取附近关注点:

语法

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

示例

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

过程地缘:

语法

processGeofence(geofence, <transitionType>): void

示例

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

获取当前利益点 :

语法

getCurrentPointsOfInterest(): Promise<Array<PlacesPOI>>

示例

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

获取最后已知位置

语法

getLastKnownLocation(): Promise<PlacesLocation>

示例

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

清除

语法

clear(): void

示例

Places.clear();

设定授权状态 :

语法

setAuthorizationStatus(authStatus?: PlacesAuthStatus): void;

示例

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体验平台支持回放原生应用程序.

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