Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

App Bluetooth Lags

 
Eve Wong
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I have an Android app that basically receives a stream of strings as long as it's connected to my company's product via Bluetooth and then updates a count keeping track of the number of times I receive a line containing 'INV1'. I can send some commands to the product, but I've noticed that after writing anything to the BluetoothSocket- whether a valid command or not, the stream my app receives starts visibly lagging. As long as I don't write to the socket, the stream is fine. I asked the developer who works on the product, and all he could tell me was that from his side, my app starts asserting hardware flow control a lot more after the write.

My code builds off the example on the Bluetooth page from Android Developers. ConnectThread establishes the connection, SocketReaderThread reads lines nonstop from the socket and depending on if I'm in receiving (isSending=false) mode or prepared to send a command (isSending=true), adds the line to the corresponding BlockingQueue. SentenceHandlerThread deals with taking the strings from the queue and checking if it contains the string I want, and updates UI accordingly. In a nutshell, I'm not sure what, on my side, could be causing the lag after writing to the socket, if it's my app, or the OS itself, or just what... any help would be really appreciated. I'm using KitKat 4.4.2 and 4.4.4 to test my app.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic