react-native-ai-navigation-sdk
v0.4.10
Published
A react native wrapper around combain ai navigation sdk
Readme
react-native-ai-navigation-sdk
A react native wrapper around combain ai navigation sdk
Installation
npm install react-native-ai-navigation-sdkUsage
import { initSDK } from 'react-native-ai-navigation-sdk';
// ...
const sync: SyncingInterval = {
interval: 1,
};
const routingConfig: ReactRoutingConfig = {
routableNodesOptions: ReactRoutableNodesOptions.All,
};
const indoorNavigationSDKConfig: ReactIndoorNavigationSDKConfig = {
apiKey: "API-key",
routingConfig: routingConfig,
syncingInterval: sync,
};
const initializeSDK = async () => {
try {
await initSDK(indoorNavigationSDKConfig);
console.log('SDK initialized');
await start()
console.log("SDK STARTED")
} catch (error) {
console.error('SDK initialization error:', error);
}
};Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Installation
todo: https://github.com/zoontek/react-native-permissions?tab=readme-ov-file#expo Made with create-react-native-library
Android installment
Currently only works with android
In react native without expo
Go to the prebuild android folder, change minSDK version from 23 to 28
add following to the build.gradle folder in the app directory
repositories {
mavenCentral()
google()
maven{
url "https://gitlab.com/api/v4/projects/3194773/packages/maven"
}
}If you are running an expo application generate an android prebuild by running
npx expo run:androidDoes not work with expo go, need to run the sdk in native apps Use the generated prebuild and do the same steps as in react app without expo
React native eventlisteners
For the native code to communciate back to the JS implementation, the js has to listen to certain events by calling
const eventListener = DeviceEventEmitter.addListener('eventName', (params) => {
setParam(param);
});Each event will give a param which is a readableMap that can be used to match certain datatypes in the SDK
Event Types in React Native AI Indoor SDK
The React Native AI Indoor SDK provides various events to help you track and manage different aspects of the indoor navigation system. Below is a list of the available event types:
routeUpdatedTriggered when the route information is updated. Will returnReactNativeRoutingPositionas paramnextScanTimeUpdateIndicates the next scan time update. Will returnnumberas param but to extract the number simply do param.nextScannewModelUpdateSignifies an update to the model. Will returnstringas param but to extract the number simply do param.modelTypewifiUpdateSignifies an update to the wifi pipe results. Will returnReactNativeWifiPipeResultas parambleUpdateRelates to updates in Bluetooth pipe results. Will returnReactNativeBLePipeResultas paramnewGpsLocationUpdateReflects a new GPS location update. Will returnReactNativeGpsLocationas paramlocalLookUpPipeResultUpdateUpdates related to local lookup results. Will returnReactNativeLookUpPipeResultas paramconfidenceScoreUpdateIndicates a change in the confidence score. Will returnnumberas param to extract the number call param.confidenceScoreusingGPSUpdateShows updates on the usage of GPS. Returns if gps is used for positioning or not as param
iOS setup
Permissiosn
To setup iOS permissions some setup is needed, first add this to your Podfile:
```diff
# Transform this into a `node_require` generic function:
- # Resolve react_native_pods.rb with node to allow for hoisting
- require Pod::Executable.execute_command('node', ['-p',
- 'require.resolve(
- "react-native/scripts/react_native_pods.rb",
- {paths: [process.argv[1]]},
- )', __dir__]).strip
+ def node_require(script)
+ # Resolve script with node to allow for hoisting
+ require Pod::Executable.execute_command('node', ['-p',
+ "require.resolve(
+ '#{script}',
+ {paths: [process.argv[1]]},
+ )", __dir__]).strip
+ end
# Use it to require both react-native's and this package's scripts:
+ node_require('react-native/scripts/react_native_pods.rb')
+ node_require('react-native-permissions/scripts/setup.rb')
+ setup_permissions([
+ 'LocationWhenInUse',
+ 'Motion',
+ ])Then execute pod install in your ios directory
Then add these keys to your Info.plist
<key>NSLocationWhenInUseUsageDescription</key>
<string>We need this permisison to determine your location</string>
<key>NSMotionUsageDescription</key>
<string>We need this permisison to determine your location</string>