Android Question Connect to device with bluetooth

PoleStar

Member
Licensed User
Longtime User
hi
i have a question
Haw can connect to special machines with bluetooth?
Note:
I want the default name and password to connect to the device is stored in the app and the user will be asked


It is possible in programming?

thanks :)
 

edgar_ortiz

Active Member
Licensed User
Longtime User
Hi Pantea

You can try

B4X:
Sub butConnect_Click
    Dim PairedDevices        As Map
    '
    PairedDevices = Main.o_Serial.GetPairedDevices
    Dim l As List
    l.Initialize
    For i = 0 To PairedDevices.Size - 1
        lcPrinterName    = PairedDevices.GetKeyAt(i)
        l.Add(lcPrinterName)
    Next
    '
    Dim res As Int
    res = InputList(l, "Select Printer", -1) 'show list with paired devices
    If res <> DialogResponse.CANCEL Then
        lcPrinterAddress    = PairedDevices.Get(l.Get(res))
        lcPrinterName        = l.Get(res)
        Msgbox("Conectarse a: " & l.Get(res), lcPrinterAddress)
        Main.o_Serial.Connect(lcPrinterAddress) 'convert the name to mac address
    End If

End Sub

Regards,

Edgar
 
Upvote 0
Top