Skip to main content
Use two physical phones, Bluetooth enabled, with the app in the foreground. This walkthrough pins React Native 0.76.5 and Mesh SDK 0.27.0. It uses the native libraries in the npm package; a Rust checkout, NDK build of the SDK and local file: dependency are not required. This walkthrough is typechecked against the pinned packages. For complete apps on the same package, see offline-app-examples: four React Native apps on Mesh SDK 0.27.0.

Create the host

Install the platform development tools from the React Native environment guide: Node, JDK 17 and Android Studio for Android; Xcode and CocoaPods for iOS. Use Node 22 for this walkthrough.
For iOS, install pods:
Apply the Info.plist and Android manifest entries. BLE permissions are required; phone Wi-Fi Direct and MultipeerConnectivity cannot carry traffic in SDK 0.27.0. Do not enable Android mesh wake for this foreground exercise.

Add the messaging module

Create mesh.ts in the project root. Copy the complete TypeScript module from Start and discover a peer, including its imports and exported functions. Create permissions.ts in the project root. Copy the complete requestMeshPermissions helper, including its React Native imports, from Android runtime permissions. The helper returns immediately on iOS; the system prompts when Bluetooth starts.

Add the screen

Replace App.tsx with:
Fast Refresh must not create a second native protocol instance. After editing the module that constructs OfflineProtocol, perform a full app reload. Do not call destroy() when stopping and restarting this screen.

Run and check

Start Metro with npm start. In another terminal run npm run android or npm run ios, choosing a physical device. Install and launch the same app on the second phone.
  1. Tap Start mesh on both phones and grant permissions.
  2. Check the discovered off1 address and reported ble transport.
  3. Tap Send inspection update for the discovered peer. The SDK queues the message until its encrypted session is ready; a queued ID is not delivery.
  4. Confirm the JSON appears on the receiving phone and the sender reports SDK delivery.
  5. Turn off cellular and Wi-Fi, leaving Bluetooth enabled. Repeat.
  6. Stop and start both instances and repeat to check listener reuse.
This is a foreground discovery and messaging exercise. Add durable application storage and acceptance before using it for an operational handoff. If no peer appears, check troubleshooting.