Home > database >  Need android.permission.BLUETOOTH_CONNECT permission error
Need android.permission.BLUETOOTH_CONNECT permission error

Time:12-04

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.flutterbluetooth">
        <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" />
   <application
        android:label="flutterbluetooth"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher">
        <activity
            ...
        </activity>
        
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

I am trying to get bluetooth permission in flutter. But I am getting the error in the title.

CodePudding user response:

You might need to declare these additional permissions which are newly added, along with legacy bluettoth permission. You can choose only specific permission based on your requirement.

<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />

<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />

<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />

Read more here.

CodePudding user response:

It looks like you're missing the <uses-feature> tag in your AndroidManifest.xml file. This tag is required in order to declare that your app uses the Bluetooth feature:

<uses-feature android:name="android.hardware.bluetooth" android:required="true" />
  • Related