Finding Code Blocks from MIT 1 in MIT 2 (how to pair bluetooth devices)

Wow, thank you very much for your answer, I will check the extension out as well, that's great news my dear!

In my applications I use this:

Opening BT settings:

A request to enable BT:

1 Like

Thank you dear, works like a charm now!

From the conversation I understand that you need to pair with a BT device, knowing its address and name without going to the settings?

Thank you very much for the snippets, very useful example for us beginners especially right there!

Yup, that is the ultimate goal my dear.

At the moment I got it working by making the Pair Button to get me to the BT settings menu thanks to Taifun's advice!

I will also check that free Bluetooth Extension that @SteveJG recommended, that may be the key to achieve my goal. As for now, I am very happy with the results I got in such short time with your help guys, could've take me weeks to figure all this new stuff out by myself. Hope this thread will also help other beginners looking for answers out there now and in the future :slight_smile:

Why does my activity with "one" block work the same as your activity with three blocks?

This extension works. Unfortunately, it requires location permissions, which may arouse suspicion and aversion to the application.

No problem for me, since the app I am working at is supposed to meassure distance between my phone and the esp32 device my dear. But I guess you can take a look into the blocks, check where the blocks that ask for location are placed and delete them (also check if there is any activity module that is used to ask for location permission) my dear.

Yes, that's true.
Latest versions of android want your app to have location permission to search for nearby devices.

this is not "my" activity... this was mentioned in that old tutorial...
and in doubt use the solution, which requires less blocks, in this case your method...

Taifun

Briefly, I just called "mine, yours" so you know what's going on. This one line works, for sure on Android 8, 9 and 10.

Exactly. Ordinary application users do not know this. They will see the location permission in the application, they imagine that they are being tracked :). So if in-app pairing is not required, better avoid it :).

Right.
But where is the issue in this ? :sweat_smile:
Most of the my extensions don't ask for permissions themselves.
They only add the permissions in manifest and from Android 6 you must ask for permissions at runtime along with declaring them in manifest.

Have you seen it?
What is this? Can I pair devices without location permission?
https://developer.android.com/reference/android/companion/CompanionDeviceManager

Yes.

An official workaround.

Yes.

But it works on Android 8+ devices.

Considering that hardly anyone has a phone for more than 2-3 years, it's probably not a problem? Hardly anyone has a phone that is 5 years old :smiley:
We can also apply a condition to the android version in the application. If +8 then ... else ...

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.