How to get the name of Bluetooth Device which is connected?

Hi,
I have created Arduino project and able to transmit data through HC05 Bluetooth Module.

in MIT App Inventor, I have created a android App to receive the data using tutorials.
I am able to receive the data over Bluetooth connection.

My query is how to display a name of the Bluetooth device which I am connecting using my Mobile phone?
on the Android app which is created using MIT App Inventor, I want to show the display name of the device which is connected and sending the data to mobile phone.

I tried options in List picker and Bluetooth client but not found anything related.
Please suggest suitable commands to do same.

Hi
Well, the Bluetooth Device does not necessarily have a “name” as such but to connect to it, you selected from a list of available devices, correct? That selection (List Item) can be displayed in a Label, but most common is to use a List Picker Component for the List and when the selection is made by the User, the List Picker button is set with the device “name”:

Dear ChrisWard,
Thank you for your reply.
I will check the blocks shared by you.

  • I have programmed HC-05 Bluetooth module and given it name: say “Sensor 1”
  • which I will like to display once connected

below are the existing blocks I have used

OK, if you have imposed a name, that could show up as part of the device Address, which BT lists. Experiment!

Hi,

I tried as mentioned in your block - listpicker - selection.
It gives me value true or false



Hi,
I want to set label 6 - text as Name of the Device which is selected.
Which is the suitable block to be added in code?

Sorry, see my code above, correct yours as per mine, then let us know what you get.

Hi,
I have updated the code as mentioned in your message.
I got the value “true” instead of device name.

Should I use tinydb to store and get the device value?

unfortunately you did not provide a screenshot of your updated relevant blocks, so noone can know, what exactly you are talking about…

to get the name of the conected bluetooth device, use the split block from the text drawer, split Listpicker.Selection at space, then use the select list item block to select the second item

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.