Septatrivanto Wandy
Septatrivanto Wandy

Reputation: 57

Android 12 bluetooth permission for react-native 0.62

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?

Upvotes: 0

Views: 6746

Answers (2)

Alan
Alan

Reputation: 700

I've had similar issues with bluetooth permissions and Android 12+.

I solved it by asking permissions for BLUETOOTH_SCAN. Here's my full answer

Upvotes: 0

dev404
dev404

Reputation: 1135

There are one way to go around it....

  1. 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)

Upvotes: 1

Related Questions