Android Question Weird issue with SPP on L+

techknight

Well-Known Member
Licensed User
My apps which use bluetooth SPP to communicate with devices, all work fine with samsung tab 3, and before.

But I noticed the latest version of tab3 lites, and tab4s, and my s6 edge which all have Android L, have issues.

I will get random errors such as:
java.io.IOException: read failed, socket might closed or timeout, read ret: -1

and then sometimes it will connect fine, and then it sends 3 random bytes through the BT connection instead of the real packet, and sometimes it works fine. its very erratic/random. Then when I hit the back arrow to get out of the app, it will close unexpectedly sometimes. And, the logcat in the IDE through USB debugging isnt catching the exception so I dont see what happened.

Go back to my older devices which are running kitkat, problems gone. So... I dunno what to do. My S6 edge does very similar things as the Tab 3 Lite that I have. I have a gut feeling it has something to do with the dalvik/art switchover.

I am compiling with API21, in the process of downloading API22 to see if it makes any difference.

any ideas?
 

techknight

Well-Known Member
Licensed User
No, I am not running a bluetooth server.

I actually do a scan for devices, then a connect. Basically duplicating the tutorial. Once the serial1.connect is successful, it opens the astream, and sends a packet.

I did notice every once in awhile, the bluetooth name will come up empty, but the MAC is there. But its always done that.

Oh, and I forgot to mention. The device in question with issues, will list 6 or 7 copies of the same bluetooth dongle in the spinner after scanning for devices. it sees my computer 3 or 4 times.

Its the only device that does this.
 

Erel

Administrator
Staff member
Licensed User
Also, how do I make it stable?
There is nothing that you can do about it. It depends on the Android device. I think that Android 4.x+ devices are more stable than the older devices.

About the UUID, you should use Serial.Listen2 and Connect2 and set the UUID. The default value is: 00001101-0000-1000-8000-00805F9B34FB
 

techknight

Well-Known Member
Licensed User
Well, I am always making an outgoing connection to a device, Never the other way around, so I wont use Listen. Just Connect.

But I noticed the Tab3 Lite running Android L has serious issues with bluetooth and my app, Same thing when using the example discovery mode, the spinner is full of duplicates or missing text tags. etc... The older tab 3 lite running kitkat had no issues.

The tab 4 running kitkat, no problems at all.
 

techknight

Well-Known Member
Licensed User
How do I know what UUID to use? I tried making one up by changing the B to a C, and I get timeout.
 

techknight

Well-Known Member
Licensed User
Connecting to an out-board bluetooth serial dongle from my app.

My application actually controls LED hardware via a bluetooth link to an LM048/LM058 bluetooth dongle. Which works fine. On certain tablets/hardware.
 
Top