Ionic3: Bluetooth permissions not working on android after upgrading to Cordova 11 (Android 12)

After updating the cordova version on my project from Cordova 9 to Cordova 11 to make it compatible with Android 12, the app stopped asking for the bluetooth permission. All the others permissions are working fine. Here’s my config:

Ionic version: 3.20.0
Cordova version: 11.0.0
Node version: 10.16.0
Npm version: 6.14.12

I’m using "cordova-plugin-android-permissions": "^1.1.0" and have already tried using cordova-diagnostic-plugin (no success). I’m requesting with the following code:

grantPermissions() {
    this.androidPermissions.requestPermissions([this.androidPermissions.PERMISSION.ACCESS_FINE_LOCATION,
    this.androidPermissions.PERMISSION.BLUETOOTH_SCAN,this.androidPermissions.PERMISSION.ACCESS_COARSE_LOCATION]).then(result => {
if (result.hasPermission) {
          this.nextPage();
        }
      }
      )
      .catch(
        error => {
          if (error == "cordova_not_available") {
            this.nextPage();
          }
        });
 }

check this docs about bluetooth permission changes on Android 12

Following the article, I tried to modify androidManifest from:

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

to

    <uses-permission android:maxSdkVersion="30" android:name="android.permission.BLUETOOTH" />
    <uses-permission android:maxSdkVersion="30" android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.BLUETOOTH_SCAN" />

But when I run ionic cordova run android I get the errors
Element uses-permission#android.permission.BLUETOOTH at AndroidManifest.xml:57:5-68 duplicated with element declared at AndroidManifest.xml:34:5-95
and
Element uses-permission#android.permission.BLUETOOTH_ADMIN at AndroidManifest.xml:58:5-74 duplicated with element declared at AndroidManifest.xml:35:5-101 because the cli re-adds BLUETOOTH and BLUETOOTH_ADMIN to the end of the AndroidManifest. Resulting in this:

<manifest>
...

    <uses-permission android:maxSdkVersion="30" android:name="android.permission.BLUETOOTH" />
    <uses-permission android:maxSdkVersion="30" android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
 
...

    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
</manifest>

What should I do? is there a way to build/run without changing AndroidManifest or to set theses permissions directly on config.xml?