The package is autolinked. After npm install and an iOS pod install, rebuild the native app. A Metro reload is not enough, because the OpenNHP libraries are native binaries.
Works in apps that compile their own native projects (the React Native CLI, or Expo with expo prebuild / a development build).
Expo Go does not include this module. Add the package, run npx expo prebuild, then npx expo run:ios and npx expo run:android.
The module is a classic React Native native module (NativeModules.OpenNhp). Current React Native releases load that style of module through the New Architecture interop layer.
- Deployment target 15.1 or newer. The podspec sets this on the pod. Set the app target to 15.1 or newer as well.
cd ios && pod installafter every install or upgrade of this package.- The pod vendors
ios/Frameworks/nhpagent.xcframework(devicearm64, simulatorarm64andx86_64). - Linked system libraries: Foundation, CoreFoundation, Security,
libresolv, andlibc++.
Local-network knocks need an app Info.plist entry:
<key>NSLocalNetworkUsageDescription</key>
<string>This app contacts the local OpenNHP server.</string>Outbound UDP to a public host does not need that key. There is no extra background mode. Knocks run while the app process is alive. close when the user is done, because iOS can suspend the process.
minSdkVersion24 or newer. The.sofiles themselves are built with Android API 21.- Java 17 for the library module.
- ABIs packaged:
arm64-v8a,armeabi-v7a,x86,x86_64. Restrict the app'sabiFiltersto a subset of these. An ABI outside this list fails the native build. android.permission.INTERNETis merged from this package. No storage permission is required when the working directory isgetDefaultWorkingDirectory()(the app files directory).arm64-v8alibraries are aligned for 16 KB memory pages.
The emulator's 10.0.2.2 is the host machine. 127.0.0.1 is the emulator itself. A physical device needs the server's LAN or public address, and the network must allow UDP to the nhp-server port.
Autolinking covers React Native 0.60 and newer. In an older app:
iOS. Add react-native-opennhp.podspec as a pod and run pod install.
Android. Add the package project in android/settings.gradle and register com.reactnativeopennhp.OpenNhpPackage in the host MainApplication.
Install the new version, run pod install, then clean-build both apps. The native binary changes even when the JavaScript API does not.