Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 12 #21

Open
markarupert opened this issue Dec 27, 2022 · 1 comment
Open

Android 12 #21

markarupert opened this issue Dec 27, 2022 · 1 comment

Comments

@markarupert
Copy link

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

@ragcsalo
Copy link

ragcsalo commented Feb 28, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants