Issue
According to https://developer.android.com/guide/topics/connectivity/bluetooth/permissions
There are need to grant permission manually to handle bluetooth for android 12 (API level > 30)
uses-permission android:name="android.permission.BLUETOOTH_SCAN"
uses-permission android:name="android.permission.BLUETOOTH_CONNECT"
But according to https://reactnative.dev/docs/0.62/permissionsandroid
These two PermissionsAndroid in RN 0.62 are not available and only available for RN ^0.66 causing error permission is null.
Is there any solution to use these permission in RN 0.62?
Solution
There are one way to go around it....
- Upgrade the target or compileSDK (don't remember exactly which one - but since you are already working with android 12, I'm assuming you've already set it to sdk 30), use a package like https://www.npmjs.com/package/react-native-permissions
Or....... Upgrade your entire app to latest react native version (I recently upgraded my two projects from react native 0.63 to latest and it was pure chaos and pain :) - nah just exaggerating, it feels so great to have your apps on latest version)
Answered By - dev404
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.