D
Deleted member 103
Guest
Hello,
with the first Bluetooth connection I store the MAC address in the settings, so that with the next connection, the connection goes faster.
In the Google Report but always this error comes, and I do not understand why, or I find in my code no errors.
Here is my code:
and here the crash report:
It would be nice if someone might find the mistake.
with the first Bluetooth connection I store the MAC address in the settings, so that with the next connection, the connection goes faster.
In the Google Report but always this error comes, and I do not understand why, or I find in my code no errors.
Here is my code:
B4X:
Sub Admin_DiscoveryFinished
CallSub3(Main,"ShowProgressDialog","",False)
If foundDevices.Size = 0 Then
ToastMessageShow(Starter.language.value("strBluetoothNoFound"), True)
Else
Dim Macfound As NameAndMac
Macfound.Initialize
Macfound.Name = "" 'Sicherstellen das der Name Leer ist.
Dim lst As List
lst.Initialize
For i = 0 To foundDevices.Size - 1
Dim nm As NameAndMac
nm = foundDevices.Get(i)
lst.Add(nm.Name)
If Starter.manager.GetString("BtMacAddress") = nm.Mac Then
Macfound = nm
Exit
End If
Next
If Macfound.Name <> "" Then
ConnectToKnownDevice(Macfound)
Else
'If lst.Size > 0 Then CallSub2(Main,"ChooseDevice", lst)
CallSub2(Main,"ChooseDevice", lst)
End If
End If
End Sub
Sub ConnectToKnownDevice(BtMac As NameAndMac)
connectedDevice = BtMac
CallSub3(Main,"ShowProgressDialog",Starter.language.value("strBluetoothConnect") & " " & BtMac.Name & " (" & BtMac.Mac & ")",True)
serial1.Connect(BtMac.Mac)
End Sub
and here the crash report:
20. Okt. 17:59 in der App-Version 97
Samsung Galaxy S5 Neo (s5neolte), Android 6.0
Bericht 1 von 1
java.io.IOException:
at android.bluetooth.BluetoothDevice.createRfcommSocketToServiceRecord (BluetoothDevice.java:1886)
at anywheresoftware.b4a.objects.Serial.Connect2 (Serial.java:147)
at anywheresoftware.b4a.objects.Serial.Connect (Serial.java:117)
at fg.cronomillemiglia.clsbluetooth._vvvvvvvvvvvvvvvvvvvvvvvvvvv5 (clsbluetooth.java:436)
at fg.cronomillemiglia.clsbluetooth._admin_discoveryfinished (clsbluetooth.java:149)
at java.lang.reflect.Method.invoke (Native Method)
at anywheresoftware.b4a.BA.raiseEvent2 (BA.java:191)
at anywheresoftware.b4a.BA.raiseEvent (BA.java:171)
at anywheresoftware.b4a.objects.Serial$BluetoothAdmin$1$1.run (Serial.java:341)
at android.os.Handler.handleCallback (Handler.java:739)
at android.os.Handler.dispatchMessage (Handler.java:95)
at android.os.Looper.loop (Looper.java:158)
at android.app.ActivityThread.main (ActivityThread.java:7230)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)
It would be nice if someone might find the mistake.