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

Humberto

Active Member
Licensed User
Longtime 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


"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: 304

Humberto

Active Member
Licensed User
Longtime 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
Longtime 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
Longtime 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
Longtime User
This line if from another software that is always running in this phone

Provider: network - Time: 11:19 - Long: -46.6905628 - Lat: -23.5556174

I need to unistall it?
 
Upvote 0

Humberto

Active Member
Licensed User
Longtime 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
Cookies are required to use this site. You must accept them to continue using the site. Learn more…