Android Question Serial Name?

Lee Ingram

Member
Licensed User
Longtime User
How do you get the serial Name of the selected device?

I can get the mac address, but I haven't figured out how to get the selected name out of the snipit.

Thank you, Lee


Returns a map with the paired devices friendly names as keys and addresses as values.
The following code shows a list of available devices and allows the user to connect to one:
B4X:
Dim PairedDevices As Map
PairedDevices = Serial1.GetPairedDevices
Dim l As List
l.Initialize
For i = 0 To PairedDevices.Size - 1
l.Add(PairedDevices.GetKeyAt(i))
Next
Dim res As Int
res = InputList(l, "Choose device", -1) 'show list with paired devices
If res <> DialogResponse.CANCEL Then
Serial1.Connect(PairedDevices.Get(l.Get(res))) 'convert the name to mac address and connect
End If
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
1. Use code tags when posting code!
2. Look in the list PairedDevices. The keys are the name. the value of the map is the macadr
 
Upvote 0
Top