Android Question BluetoothAdmin after disable the bluetooth in config start calling Serial_Connected

Humberto

Active Member
Licensed User
I´m testing the bluetooth connection.

When I run the program it reads all bluetooth arround and stop.

If I go to Android Config anf disable the bluetooth the "Serial_Conected" routine inside BluetoothAdmin is calling without stop, even if you turn the bluetooth on again it doesn´t stop calling

The log is bellow

*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
VIVOFIBRA-C958-5G,WPA2,-25,Saved,10:72:23:1d:c9:63,100,5540,5530,0,2,108,2,0.08
hsp,WPA2,-26,Saved,06:72:23:1d:c9:63,100,5540,5530,0,2,108,2,0.09
hsp,WPA2,-34,Saved,10:72:23:1d:c9:56,100,2462,0,0,0,11,1,0.49
MAIA,WPA2,-67,,90:58:51:ac:9f:91,66,2412,0,0,0,1,1,22.14
#NET-CLARO-WIFI,NONE,-67,,92:58:51:ac:a0:92,66,2412,0,0,0,1,1,22.14
PublishNews 3,WPA2,-67,,88:f7:c7:9f:5c:5c,66,2457,0,0,0,10,1,21.73
PublishUBQ,WPA2,-73,,7a:8a:20:db:13:75,54,5745,5755,0,1,149,2,18.54
PublishUBQ,WPA2,-73,,78:8a:20:da:13:75,54,2412,0,0,0,1,1,44.17
MAIA5G,WPA2,-79,,90:58:51:ac:9f:92,42,5180,5210,0,2,36,2,41.04
** Activity (main) Pause, UserClosed = false **
state changed: 13
connected G6: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
state changed: 10
connected G6: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
connected G6: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
state changed: 11
connected G6: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
state changed: 12
connected G6: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
connected G6: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
connected G6: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
connected G6: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
connected G6: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1

"State Change 13 " indicate that I turn off the bluetooth and the line "State Change 12" indicate that the bluetooth is on again

The project is attached

Thanks
 

Attachments

  • Bluetooth_test.zip
    11.9 KB · Views: 106

Humberto

Active Member
Licensed User
Hi, sorry but I got just now two other Smartphones to test

With Moto G5 Plus android 8.1 and Moto G6 plus android 9 occurs the same problem.
 
Upvote 0

Humberto

Active Member
Licensed User
With the Chat example, when I press the button "make Device Discoverable" authorize and then Disable the Bluetooth even if I close the program , enable the bluetooth again, the error continue until I turn off th cellphone

B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
state changed: 11
Bluetooth State false
state changed: 12
Bluetooth State true
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
state changed: 13
Bluetooth State false
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
state changed: 10
Bluetooth State false
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
** Activity (main) Pause, UserClosed = false **
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
state changed: 11
Bluetooth State false
state changed: 12
Bluetooth State true
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
 
Upvote 0

Humberto

Active Member
Licensed User
I put a Log in "ConnectTo" and there is no call to that routine just call to "Serial_Connected"

B4X:
Public Sub ConnectTo (Device As NameAndMac)
    Log ( "*** ConnectTo Call ****")
    
    serial.Connect(Device.Mac)
End Sub

B4X:
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
Provider: network - Time: 11:18 - Long: -46.6903044 - Lat: -23.556019
state changed: 13
Bluetooth State false
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
state changed: 10
Bluetooth State false
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
** Receiver (detect_bluetooth) OnReceive **
** Service (detect_bluetooth) Start **
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
** Activity (main) Pause, UserClosed = true **
** Service (starter) Destroy (ignored)**
Provider: network - Time: 11:19 - Long: -46.6905628 - Lat: -23.5556174
 
Upvote 0

Humberto

Active Member
Licensed User
I run the app in debug mode, when these erros occurs I stop runnig and the erros stops.
If I call again the program no error occurs until I do the sequence again
 
Upvote 0
Top