@expofp/react-native-efp-crowdconnected

中文文档
0.1.14发布于 2026/11/11MITTypeScriptCommonJS零依赖近 30 天下载 8967

React Native wrapper for ExpoFP around CrowdConnected SDK

原始使用文档
文档目录23 节
  1. Features
  2. Requirements
  3. Installation
  4. iOS
  5. Android
  6. Quick Start
  7. API Reference
  8. setup(settings: ExpoFpLocationSettings): Promise<ExpoFpProv…
  9. startUpdatingLocation(): Promise<ExpoFpProviderInfo>
  10. stopUpdatingLocation(): Promise<ExpoFpProviderInfo>
  11. isLocationUpdating(): Promise<ExpoFpProviderInfo>
  12. onLocationChange(callback: (position: ExpoFpPosition) => vo…
  13. onError(callback: (error: Error) => void): Unsubscribe
  14. Simulation Mode
  15. activateSimulation(token: string): void
  16. deactivateSimulation(): void
  17. onSimulationConnected(callback: () => void): Unsubscribe
  18. onSimulationDisconnected(callback: () => void): Unsubscribe
  19. onSimulationError(callback: (error: Error) => void): Unsubs…
  20. Development
  21. Setup
  22. Commands
  23. Support

@expofp/react-native-efp-crowdconnected

React Native Turbo Module for CrowdConnected location tracking and indoor positioning services. Provides cross-platform access to GPS, IPS (Indoor Positioning System), and Bluetooth-based positioning on iOS and Android.

npm npm downloads license

Features

  • 📍 Multi-positioning support: GPS, Indoor Positioning (IPS), and Bluetooth
  • 📱 Cross-platform: Native iOS (Swift) and Android (Kotlin) implementations
  • ⚡ React Native New Architecture: Built as a Turbo Module for optimal performance
  • 🔔 Event-based: Real-time location updates via event listeners
  • 🔄 Background support: Optional background location updates
  • 🎯 Heading tracking: Compass/bearing information
  • 📦 TypeScript first: Full type safety with generated type definitions

Requirements

  • Android 7.0+ (API level 24+)
  • iOS 16.0+ (required by the bundled CrowdConnected SDK)

Installation

npm install @expofp/react-native-efp-crowdconnected
# or
yarn add @expofp/react-native-efp-crowdconnected

iOS

cd ios && pod install

Your host app's Info.plist must declare the relevant location/Bluetooth usage descriptions and UIBackgroundModes entries. See example/ios/ExpofpCrowdconnectedExample/Info.plist for a working configuration.

Android

Gradle resolves the dependencies automatically. The CrowdConnected SDK AARs (net.crowdconnected.android.{core,background,geo,ips}, fetched from CrowdConnected's Maven repository) contribute the foreground-service declaration and the following permissions via Gradle's manifest merger. You do not need to declare them in your host app's AndroidManifest.xml: INTERNET, ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION, FOREGROUND_SERVICE, FOREGROUND_SERVICE_LOCATION, BLUETOOTH_SCAN, BLUETOOTH_CONNECT, and the legacy BLUETOOTH / BLUETOOTH_ADMIN (maxSdkVersion=30).

If you set isBackgroundUpdateEnabled: true, your host app must also declare:

<!-- AndroidManifest.xml -->
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

ACCESS_BACKGROUND_LOCATION cannot be granted from the standard runtime prompt on Android 11+; the system redirects the user to the app's settings screen, where they must select "Allow all the time".

Quick Start

import { CrowdConnectedLocationProvider } from '@expofp/react-native-efp-crowdconnected';

// Initialize
await CrowdConnectedLocationProvider.setup({
  appKey: 'your-app-key',
  clientId: 'your-client-id',
  clientSecret: 'your-client-secret',
  navigationType: 'all', // 'all' | 'GEO' | 'IPS'
  isBackgroundUpdateEnabled: false,
  isBluetoothEnabled: true,
  isHeadingEnabled: true,
});

// Listen to location updates
const unsubscribe = CrowdConnectedLocationProvider.onLocationChange((position) => {
  console.log('Location:', position);
  // { lat: number, lng: number, x?: number, y?: number, z?: string | number, angle?: number }
});

// Listen to errors
const unsubscribeError = CrowdConnectedLocationProvider.onError((error) => {
  console.error('Location error:', error);
});

// Start tracking
CrowdConnectedLocationProvider.startUpdatingLocation();

// Check if location tracking is active
const isUpdating = await CrowdConnectedLocationProvider.isLocationUpdating();

// Stop tracking
CrowdConnectedLocationProvider.stopUpdatingLocation();

// Cleanup
unsubscribe();
unsubscribeError();

API Reference

setup(settings: ExpoFpLocationSettings): Promise<ExpoFpProviderInfo>

Initializes the CrowdConnected SDK with configuration.

Parameters:

  • appKey - CrowdConnected application key
  • clientId - CrowdConnected client ID
  • clientSecret - CrowdConnected client secret
  • navigationType - Positioning type: 'all' (GPS + IPS), 'GEO' (GPS only), 'IPS' (indoor only)
  • isBackgroundUpdateEnabled - Enable background location updates
  • isBluetoothEnabled - Enable Bluetooth-based positioning
  • isHeadingEnabled - Enable compass/heading tracking
  • aliases? - Custom location aliases (optional)

Returns: Promise resolving to ExpoFpProviderInfo ({ deviceId?, isLocationUpdating })


startUpdatingLocation(): Promise<ExpoFpProviderInfo>

Starts location tracking.


stopUpdatingLocation(): Promise<ExpoFpProviderInfo>

Stops location tracking.


isLocationUpdating(): Promise<ExpoFpProviderInfo>

Returns the current provider state.


onLocationChange(callback: (position: ExpoFpPosition) => void): Unsubscribe

Subscribes to location updates.

Position object:

{
  lat?: number;      // Latitude
  lng?: number;      // Longitude
  x?: number;        // X coordinate (indoor)
  y?: number;        // Y coordinate (indoor)
  z?: string|number; // Z coordinate (floor/level)
  angle?: number;    // Heading in degrees
}

Returns: Unsubscribe function


onError(callback: (error: Error) => void): Unsubscribe

Subscribes to location errors.

Returns: Unsubscribe function

Simulation Mode

Simulation mode replays GPS/IPS paths on the device without physical movement. Simulated positions arrive through the regular onLocationChange listener.

const simulationToken = '<signed JWT for the simulation session>';

// The SDK must already be started (startUpdatingLocation) before activating.
const unsubConnected = CrowdConnectedLocationProvider.onSimulationConnected(() => {
  console.log('Simulation connected');
});
const unsubDisconnected = CrowdConnectedLocationProvider.onSimulationDisconnected(() => {
  console.log('Simulation disconnected');
});
const unsubError = CrowdConnectedLocationProvider.onSimulationError((error) => {
  console.error('Simulation error:', error.message);
});

CrowdConnectedLocationProvider.activateSimulation(simulationToken);

// ...later
CrowdConnectedLocationProvider.deactivateSimulation();

// Cleanup
unsubConnected();
unsubDisconnected();
unsubError();

activateSimulation(token: string): void

Starts a simulation session. Fire-and-forget: the outcome is reported via the onSimulationConnected / onSimulationError events.

  • token - A signed JWT issued for the simulation session (contains the sid session ID and exp claims)
  • The SDK must already be started via startUpdatingLocation()
  • Calling it again replaces the current session
  • Deactivate the simulation before calling stopUpdatingLocation() when a session is active

deactivateSimulation(): void

Stops the active simulation session. Safe no-op when no session is active.


onSimulationConnected(callback: () => void): Unsubscribe

Fires when the simulation session is established.


onSimulationDisconnected(callback: () => void): Unsubscribe

Fires when the simulation session ends.


onSimulationError(callback: (error: Error) => void): Unsubscribe

Fires when the simulation session fails (e.g. invalid or expired token).

Development

Setup

yarn install
yarn prepare

Commands

  • yarn lint - Run ESLint
  • yarn typecheck - Check TypeScript types
  • yarn test - Run Jest tests
  • yarn example ios - Run iOS example app
  • yarn example android - Run Android example app
  • yarn clean - Clean build artifacts

Support

版本与发布记录

@expofp/react-native-efp-crowdconnected 共发布 15 个版本,首次发布于 2025/11/06;过去 12 个月发布了 13 个版本。

版本发布日期距今
0.1.14latest2026/11/112 天前
0.1.132026/10/011 个月前
0.1.122026/09/151 个月前
0.1.112026/08/242 个月前
0.1.102026/07/213 个月前
0.1.92026/07/134 个月前

关于 @expofp/react-native-efp-crowdconnected 的常见问题

@expofp/react-native-efp-crowdconnected 是什么?

React Native wrapper for ExpoFP around CrowdConnected SDK

如何安装 @expofp/react-native-efp-crowdconnected?

在项目目录运行 npm install @expofp/react-native-efp-crowdconnected,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(*)、react-native(*)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@expofp/react-native-efp-crowdconnected 支持 TypeScript 吗?

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

@expofp/react-native-efp-crowdconnected 支持 ESM 还是 CommonJS?

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

@expofp/react-native-efp-crowdconnected 可以商用吗?

@expofp/react-native-efp-crowdconnected 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@expofp/react-native-efp-crowdconnected 的下载量有多少?

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

@expofp/react-native-efp-crowdconnected 还在维护吗?

最新版本 0.1.14 发布于 2026/11/11(2 天前);至今共发布 15 个版本,其中过去 12 个月发布了 13 个;首次发布于 2025/11/06。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。