Installation
Requirements
The SDK is a native module, so it does not run in Expo Go. A custom dev client or a bare
React Native project is required.
Install the Package
pod entry, a post_install hook, a settings.gradle include, or a MainApplication
registration. Pre-built native libraries ship in the package for both platforms.
pod install should list MeshSdk under “Auto-linking React Native modules”. The iOS native
binary ships as an XCFramework, so CocoaPods picks the right slice per build SDK and device
and simulator builds both work with no linker configuration.
iOS Setup
Info.plist
bluetooth-central is
declared.
Additional keys for Wi-Fi Direct
The iOS Wi-Fi Direct path uses MultipeerConnectivity. iOS 14+ refuses local-network discovery without these:The Bonjour service names must match the SDK’s MultipeerConnectivity service type, which is
offline-proto. MultipeerConnectivity registers both the TCP and UDP variants, so declare
both.Foundation, CoreBluetooth,
and MultipeerConnectivity.
Android Setup
What the SDK already declares
The SDK ships its ownAndroidManifest.xml, and these entries merge into your app
automatically, so you do not need to copy them:
neverForLocation flag on BLUETOOTH_SCAN and the maxSdkVersion="30" gating propagate
into your merged manifest. neverForLocation has Play Console data-safety implications you
inherit, so it is worth knowing it is there.
What your app must declare
The SDK deliberately does not force these on consumers, but the code requires them:ProGuard / R8
Nothing to configure. The SDK shipsconsumerProguardFiles, so its keep rules are applied to
your release build automatically. Without them, release builds would silently lose the BLE
mesh transport while debug builds kept working, but the rules are already handled for you.
Runtime Permissions
Android
The SDK checks permissions but never requests them. Your app must request them before callingstart(), or the SDK emits a diagnostic event at error level with “Missing Bluetooth
permissions”.
BLUETOOTH and BLUETOOTH_ADMIN are install-time permissions on API 30 and below, so they
do not need a runtime request.
You can also check and prompt for Bluetooth itself:
iOS
No runtime API call is needed. The system prompts on first CoreBluetooth use, driven by the Info.plist usage descriptions.Optional: Android Mesh Wake
This is the only manual native edit the SDK requires, and only if you want the mesh to recover after Android kills your process. Add to your app’sAndroidManifest.xml, inside
<application>:
index.js, not inside a component:
registerMeshWakeTask for the four caller obligations.
Mesh wake requires React Native 0.76.5+ when the New Architecture is enabled. Headless tasks
did not work under bridgeless before 0.76 and were patchy until 0.76.5. On RN 0.84 and 0.85 a
core bug (fixed in 0.86) can leave the wake service running after the task finishes.
Troubleshooting
Linking error
If you see the “doesn’t seem to be linked” error:- Run
pod install(iOS) and rebuild natively. A JS-only reload will not pick up native changes. - Confirm
pod installoutput listsMeshSdkunder “Auto-linking React Native modules”. - Run
npx react-native configand checkplatforms.ios.podspecPathends inMeshSdk.podspec. - Remove any leftover manual
pod 'MeshSdk'line; it can shadow the autolinked pod. - Verify you are not using Expo Go.
Simulator link failures
Undefined symbols, or “building for iOS Simulator, but linking in object file built for
iOS”, means a leftover manual post_install hook is still linking archives by hand. Remove
it per the upgrade warning above.
Upgrading to 0.21.0
A native rebuild is required, because new source files are compiled in on both platforms. Runpod install for iOS. A JS-only update will not pick them up.
Next Steps
Set up the SDK in your app