I want to create a popup to get bluetooth on off permisson

hi, here is the edited block image


the do it function is greyed out

you have to connect with the companion app as it is described here

Taifun

I did try that but there is one caveat when u use the companion app i am unable grant it permision so i am unable to connect it to ane device

Settings → Apps → MIT AI2 Companion → Permissions → Nearby devices:

Oh thanks it is now containing but i still get error saying Mac address is not valid

Probably now you are able to provide this

Taifun

Hi i am not sure how but the issue is fixed thank you very much

Fine, then show your final blocks so others can learn from them too.

Fine, but the Companion app should request this permission automatically.
@ewpatton

I only removed the second line in the after picking


And now it is not showing the Mac address not valid

Did you test you app with the APK.
If so, does it work? I don't think so (at least not on Android 12+).

No the app does work i am not sure why it won't work i just need to enable its permission manually

Ok, but do you really want the user to grant the permission manually?

Yes, this fix is already in progress:

I don't think this is correct, especially not for Android ≤ 11.

Here is a test APK that should work on all Android versions:

Maybe some can test it (on different Android versions) and give feedback.
I checked it on Android 9, 10, 11, 12.

At least these permissions must be declared in the Manifest (some only up to maxSdk=30):

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>

I added a LocationSensor (as a dummy) to declare LOCATION permissions in the Manifest (and disabled it in Designer).

Have you tried the test server I had set up for the change? The permissions should have the correct maxSdk asserted and also only ask for BLUETOOTH_CONNECT on Android S and later.

I'll check it later ...

I checked it now on the test server. Only the following permissions are declared there in the manifest:

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

So it doesn't work on Android 12+.

But these blocks (APK built on the regular AI2 server) seem to work on all Android versions:

It doesn't work before without LOCATION permission. :upside_down_face:
But apparently it is not necessary.
BluetoothClient_test.aia (8.3 KB)

These "beloved" permissions have been driving me crazy for almost 10 years. :wink:
And it seems to be getting worse every year!

I'll put this on my schedule for tomorrow. The test server should be producing the maxSdkVersion annotations, plus the new Android 12 permissions, so I'm not sure why you're seeing this behavior.