@poilabs-dev/vd-navigation-sdk-plugin
v1.0.27
Published
Official Expo Config Plugin for integrating the Poilabs Visually Disabled Navigation SDK
Maintainers
Readme
Poilabs Visually Disabled Navigation SDK Plugin
Official Expo Config Plugin for integrating the Poilabs Visually Disabled Navigation SDK into Expo (prebuild) projects.
🚀 Automatically links native dependencies and modifies required iOS/Android files.
✨ What this plugin does
When used with expo prebuild, this plugin:
- ✅ Adds required Android permissions to
AndroidManifest.xml - ✅ Adds Poilabs VD Navigation SDK dependency to
android/app/build.gradle - ✅ Adds JitPack repository to
android/build.gradle - ✅ Adds
pod 'PoilabsVdNavigation'to the iOS Podfile - ✅ Adds
use_frameworks!to the iOS Podfile - ✅ Adds
Info.plistkeys for Location and Bluetooth usage - ✅ Creates necessary bridge files for iOS and Android
📦 Installation
Install the plugin to your Expo project:
npm install @poilabs-dev/vd-navigation-sdk-plugin
# or
yarn add @poilabs-dev/vd-navigation-sdk-plugin⚙️ Configuration
Add the plugin to your app.json or app.config.js:
{
"expo": {
"plugins": [
[
"@poilabs-dev/vd-navigation-sdk-plugin",
{
"jitpackToken": "YOUR_JITPACK_TOKEN" // Get this from Poilabs
}
]
]
}
}Then run the prebuild command:
npx expo prebuildAdditional Setup Required
After running expo prebuild, you need to perform these additional steps:
Android Setup
Find the
getPackages()method and add the PoilabsPackage:override fun getPackages(): List<ReactPackage> { val packages = PackageList(this).packages // add this line packages.add(PoilabsPackage()) return packages }Clean and rebuild your Android project:
cd android ./gradlew clean cd .. npx expo run:android
iOS Setup
For iOS, you need to ensure the plugin files are properly included in your Xcode project:
Open your Xcode project
In Xcode, verify that the created files are added to your project:
PoilabsVdNavigationManager.swiftPoilabsNavigationBridge.hPoilabsNavigationBridge.m
If files are missing, you may need to manually add them from the iOS directory
Ensure the Swift bridging header includes React and PoilabsVdNavigation
🚀 Upload Pods
cd ios && pod install && cd ..Then build and run your iOS project:
npx expo run:ios🚀 Usage
After the prebuild process, you can use the SDK in your application:
import {
requestPermissions,
startPoilabsNavigation,
} from "@poilabs-dev/vd-navigation-sdk-plugin";
import React, { useEffect } from "react";
import {View } from "react-native";
export default function App() {
useEffect(() => {
async function initNavigation() {
try {
// Request permissions first
const hasPermissions = await requestPermissions();
if (!hasPermissions) {
return;
}
// Initialize the SDK
const success = await startPoilabsNavigation({
applicationId: 'YOUR_APPLICATION_ID', // Get from Poilabs
applicationSecretKey: 'YOUR_APPLICATION_SECRET', // Get from Poilabs
uniqueId: 'USER_UNIQUE_ID', // A unique identifier for the user
language: 'en', // or 'tr' for Turkish
});
await showPoilabsVdNavigation();
} catch (error: any) {
console.error("Error", error)
}
}
initNavigation();
}, []);
return (
<View></View>
);
}📝 API Reference
startPoilabsNavigation(config)
Initializes the Poilabs VD Navigation SDK with the given configuration.
Parameters
config(Object):applicationId(String): The application ID provided by PoilabsapplicationSecretKey(String): The application secret provided by PoilabsuniqueId(String): A unique identifier for the userlanguage(String, optional): Language code (e.g. "en", "tr"). Defaults to "en"configUrl(String, optional): Optional URL to redirect requests
Returns
Promise<boolean>: Resolves totrueif SDK was initialized successfully,falseotherwise
showPoilabsVdNavigation()
Shows the Poilabs VD Navigation interface.
Returns
Promise<boolean>: Resolves totrueif navigation started successfully,falseotherwise
getUserLocation()
Gets the current user location.
Returns
Promise<Object>: Resolves to location object with the following properties:latitude(Number): Latitude coordinatelongitude(Number): Longitude coordinatefloorLevel(Number|null): Floor level (null if not available)
updateUniqueId(uniqueId)
Updates the unique identifier in the SDK after initialization.
Parameters
uniqueId(String): New unique identifier for the user
Returns
Promise<boolean>: Resolves totrueif update was successful
requestPermissions()
Requests all the required permissions for the SDK to work properly.
Returns
Promise<boolean>: Resolves totrueif all required permissions are granted,falseotherwise
checkPermissions()
Checks if all required permissions are granted.
Returns
Promise<boolean>:trueif all required permissions are granted,falseotherwise
checkBluetoothPermission()
Checks if Bluetooth permissions are granted (relevant for Android 12+).
Returns
Promise<boolean>:trueif Bluetooth permissions are granted,falseotherwise
📋 Required Permissions
The plugin automatically adds these permissions:
Android
INTERNET- For network communicationACCESS_FINE_LOCATION- For precise locationACCESS_COARSE_LOCATION- For approximate locationBLUETOOTH,BLUETOOTH_ADMIN- For Bluetooth functionalityBLUETOOTH_CONNECT,BLUETOOTH_SCAN- For Bluetooth on Android 12+RECEIVE_BOOT_COMPLETED- For autostart capabilityACCESS_NETWORK_STATE- For network connectivity
iOS
NSLocationUsageDescription- Location permissionNSLocationWhenInUseUsageDescription- Location permission when app is in useNSLocationAlwaysUsageDescription- Location permission even when app is not in useNSLocationAlwaysAndWhenInUseUsageDescription- Location permissionNSBluetoothAlwaysUsageDescription- Bluetooth permissionNSBluetoothPeripheralUsageDescription- Bluetooth permission
❓ Troubleshooting
Module not found error
If you see PoilabsVdNavigationModule not found error:
- Make sure you have run
npx expo prebuild - Verify you've completed the additional setup steps for Android/iOS
- Run
npx expo run:androidornpx expo run:iosto build and run the native project - For Expo Go, this plugin will not work because it requires native modules
iOS Integration Issues
If you're having issues with iOS integration:
- Make sure the Podfile is correctly updated with
pod 'PoilabsVdNavigation' - Verify that
use_frameworks!is in your Podfile - Check that the Swift files are properly added to your project
- Run
pod install --repo-updatefrom the ios directory
Permission issues
If the SDK is not working due to permission issues:
- Make sure you have requested all the necessary permissions
- For Android, ensure Bluetooth permissions are properly granted on Android 12+
