Android Question bluetooth connect direct without choise

fifiddu70

Well-Known Member
Licensed User
Longtime User
Hello, i need to connect from one tablet to two thermal printers via bluetooth without selection choose, example: i use two edittext for insert the name or macaddress of the thermal printers, i need to insert the name in this edittext for print to a varius thermal printer, is possible?
this code is ok for my use?:
i need to connect and disconnect after print for have tablet possibility to receive other bluetooth.
B4X:
Dim PairedDevices As Map
        PairedDevices = BTConnection.GetPairedDevices
        Dim l As List
        Dim DeviceName, MacAddress As String
        l.Initialize
        For i = 0 To PairedDevices.Size - 1 'Check all devices
            l.Add(PairedDevices.GetKeyAt(i))
            DeviceName=PairedDevices.Getkeyat(i)
            MacAddress=PairedDevices.GetValueAt(i)
            Log(DeviceName & " -> " & MacAddress)
            If DeviceName.Contains(txtstampa1.Text) Then 'Insert the BT-Name of the printer or use the MAC address
           
                Exit
            End If
i use this code but not work googd, i use txtstampa1.text for insert the name or macaddress printer. i have replaced "Thermal" of the original code with txtstampa1.text.
 
Top