Android: bluetooth listen thread for incomming data only

5.5k views Asked by At

i am working on an android app in which I need to only listen for incoming devices an log the data they are sending using Bluetooth, device sending data is basically a digital Bluetooth enabled thermometer which just sends the data. Problem is i don't know where to start as i m new to android programming. Just a step by step Procedure would be enough to guide me on the right track . i tried Bluetooth chat example but i didn't took me any where also i wasn't able to understand it.

Regards, Rafiq Ahmed

1

There are 1 answers

2
Bardo91 On BEST ANSWER

First thing you need is to know how to make the connection with the thermometer. I suppose that, since the device is paired to the smartphone, you only must to manage the connection as a server (On the android-phone). Here you got a summarize:

  1. Change Bluetooth permissions: http://developer.android.com/guide/topics/connectivity/bluetooth.html#Permissions
  2. Enable and set up the bluetooth: http://developer.android.com/guide/topics/connectivity/bluetooth.html#SettingUp
  3. Find the device: http://developer.android.com/guide/topics/connectivity/bluetooth.html#FindingDevices
  4. Connect with it: http://developer.android.com/guide/topics/connectivity/bluetooth.html#ConnectingAsAServer
  5. And manage the connection: http://developer.android.com/guide/topics/connectivity/bluetooth.html#ManagingAConnection

And last thing, I recommend you to pair the device before running the application, at the adjust menu of your mobilephone. Since that, follow the previous steps and all will be fine. If you have some doubt ask me, I had the same troubles about bluetooth connections with arduino and HC-06 bluetooth device

Hope it helps