cordova-plugin-ble-peripheral
cordova-plugin-ble-peripheral copied to clipboard
Android 12
Has anyone gotten this working with Android 12. I am getting a permission error for BLUETOOTH_ADVERTISE. I put it in the AndroidManifest. and have tried enabling with cordova.plugins.diagnostic.requestBluetoothAuthorization.
This is the error I am getting.
Possibly unhandled Error: Need android.permission.BLUETOOTH_ADVERTISE permission for AttributionSource { uid = 11308, packageName = biz.geowiz.mobile, attributionTag = null, token = android.os.BinderProxy@288b4e9, next = null }: GattService startAdvertisingSet
Use the permissions plugin, and check the permission programmatically:
permissions.checkPermission('android.permission.BLUETOOTH_ADVERTISE', function( status ){
if (!status.hasPermission ) {
console.log('Requesting BLUETOOTH_ADVERTISE permission...');
permissions.requestPermission('android.permission.BLUETOOTH_ADVERTISE', function() {
console.log('BLUETOOTH_ADVERTISE granted by user :-)');
}, function() {
console.log('BLUETOOTH_ADVERTISE denied :-(');
});
}
else {
console.log('BLUETOOTH_ADVERTISE already granted :-)');
}
});
https://github.com/NeoLSN/cordova-plugin-android-permissions