The ble communicate utility on react-native.
$ yarn add bluevery
and don't forget install peerDependencies
Edit your app AndroidManifest.xml
AndroidManifest.xml
<!-- ๐จ Keep only the permissions used in your app ๐จ -->
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- ๐จ Keep only the permissions used in your app ๐จ -->
Edit your app Podfile
then run pod install
Podfile
target 'YourAppProject' do
# add the below
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-BluetoothPeripheral', :path => "#{permissions_path}/BluetoothPeripheral.podspec"
pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications.podspec"
end
Edit your app Info.plist
Info.plist
<!-- ๐จ Keep only the permissions used in your app ๐จ -->
<key>NSBluetoothAlwaysUsageDescription</key>
<string>EDIT YOUR TEXT</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>EDIT YOUR TEXT</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>EDIT YOUR TEXT</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>EDIT YOUR TEXT</string>
<!-- ๐จ Keep only the permissions used in your app ๐จ -->
Pass the debug namespace into the init options.
https://github.com/visionmedia/debug#environment-variables
await bluevery.init({
__DEBUG: 'bluevery,bluevery:*',
// ...other options
})