android-bluetooth-serial icon indicating copy to clipboard operation
android-bluetooth-serial copied to clipboard

Not receiving data from Bluetooth device

Open harshilp24 opened this issue 3 years ago • 6 comments

I am running the demo app, I am able to send data to device but not able to get data from it. The onMessageReceived method is not being called. Can you help me with this

harshilp24 avatar Mar 18 '21 08:03 harshilp24

Can you verify with, say, a Windows PC or other app/device that the data is actually being transmitted?

harryjph avatar Mar 21 '21 16:03 harryjph

Can you verify with, say, a Windows PC or other app/device that the data is actually being transmitted?

@harry1453 its a ESP32 Bluetooth chip

harshilp24 avatar Mar 21 '21 16:03 harshilp24

Could you check what message is being sent? The library expects messages to be delimited by a newline (\n) character. If you want a different delimiter, you need to use the raw outputStream.

harryjph avatar Mar 21 '21 17:03 harryjph

Have same question on ESP32. The device is actually transmitting. I wonder maybe the brud rate does not set right?

'

johnchtsai avatar May 24 '21 21:05 johnchtsai

@johnchtsai Please can you do the same as I said above? If you are just transmitting a data stream, you need to use the outputStream property to get a raw data stream. If you use openMessageStream, the library considers a newline to be the message delimiter, and if you aren't transmitting separate messages separated by newlines, this won't work and you won't receive any messages.

If you're using an ESP32 with built-in bluetooth, there is no baud rate AFAIK, as baud rate is only a property when using UART along a physical wire. When it's via Bluetooth or internally in the ESP32, there shouldn't be any baud rate, though I may be wrong. I know for a fact that this library does not take or use a baud rate.

harryjph avatar May 25 '21 11:05 harryjph

I have same problem too. When i try another program from google play, my device working currectly. When i try to debug the openMessageStream() function, the "synchronized(inputStream)" never worked. If someone has any solution can you help me?

talhacomak avatar Dec 11 '21 16:12 talhacomak