Kind Stack-overflowers, I am attempting to create an expo react native module in order to use Bluetooth, However I am experiencing a strange issue
Here is the error:
Missing permissions required by intent BluetoothAdapter.ACTION_REQUEST_ENABLE: android.permission.BLUETOOTH_CONNECT
The error occurs around this code:
val enableBtIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
AppActivity?.startActivityForResult(enableBtIntent, this.ACTION_REQUEST_ENABLE);
This error prevents my module from building, However Strangely, When I add this property to my manifest’s The one in the module with filepath: moduleName/manifests/AndroidManifest.xml
when I add the necessary permission: as such:
<manifest>
<uses-permission name="android.permission.BLUETOOTH_CONNECT" />
</manifest>
I recieve a different, Breaking error:
Attribute is missing the Android namespace prefix
, How do I fix this? is this a known error?
2
Answers
The uses-permission tag should look like this
you were missing "android:" (namespace) before "name"
also to make sure no more errors occur add the following to you opening manifest tag
The Final manifest file should look like:
BLUETOOTH_CONNECT is not the right permission to request for enabling Bluetooth. The correct permission for Bluetooth is BLUETOOTH.
Make sure to include the xmlns:android="http://schemas.android.com/apk/res/android" declaration at the beginning of the manifest tag.
This may solve your issue, let me know.