0

I want to connect my Tablet (with Android OS) to my Computer (with Ubuntu OS and Windows 8) but I don't know how to connect an Android Device to a Device with an Unknown UUID.

I found listenUsingRfcommOn, listenUsingInsecureRfcommOn, listenUsingEncryptedRfcommOn in another Stackoverflow question but I don't know what are those and how to use them. I've searched listenUsingRfcommOn in google and Android Developers Site but I got nothing. (Or at least I couldn't figure out if there was something useful or not).

Does anyone know how can I connect them? And I want some explanation and useful links for those methods.

Thanks.

Community
  • 1
  • 1

1 Answers1

3

UUID is meant to identify services , not devices. Devices are recognized by a bluetooth address which is exactly like a MAC address for Laptops/PCs. Frankly, the answer to your question is very huge considering your lack of knowledge about the subject. I suggest you start with some basic understanding of bluetooth programming. You could start with this:

Bluetooth Essentials for Programming by Albert Huang and Larry Rudolph

I'm sure you can find this ebook for free online if you look around.

Flame of udun
  • 2,136
  • 7
  • 35
  • 79
  • Thanks, I've downloaded that book but I don't have enough time to read the whole book. I've gone through Android guides for Bluetooth communication over serial port. It says we have set the same UUID for both sides. It didn't mention which UUID I should set for Serial Communication. I could connect two Android devices according to that but when I want to transfer data I see the sending side has done but the receiver doesn't get anything at all. Now I don't know what mistakes I've made and how to fix it. That's why I decided to connect my computer to an Android device. Do you have any samples? –  Aug 27 '13 at 07:51
  • The UUID for SPP is most probably 1101...Did you pair the devices before initiating communication? There is an abundance of sample codes on the internet for android.Google it – Flame of udun Aug 27 '13 at 13:35
  • Yes I did. I paired Devices first and I've already gone through some of samples for Android, I couldn't find any other ways for receiving and sending data. But it doesn't work for me. Do you have any experiences about Android Bluetooth Programming? –  Aug 27 '13 at 19:43
  • BTW I used the UUID of Bluetooth Chat Sample of Google: `UUID MY_UUID = UUID.fromString("fa87c0d0-afac-11de-8a39-0800200c9a66");` –  Aug 27 '13 at 19:45
  • I'm afraid my experience is limited to connections from laptop. I haven't worked on android Bluetooth.BTW how did you pair the devices? – Flame of udun Aug 28 '13 at 09:35
  • From device settings. First I scanned for devices then I tap on Device name and I paired them. Then I wrote a code to find its MAC Address to make the connection (You can find that piece of code in Android guides). I have to connect an Android Device to an Ubuntu computer(I'm working on a Robot). Do you have any experiences on Ubuntu or have you written code in C? –  Aug 29 '13 at 06:45
  • Hmmmm, Do you use InputStream and OutputStream for transferring data or it's only for Android? –  Aug 29 '13 at 06:52
  • Yes, I used `InputStream` and `OutputStream` too. – Flame of udun Aug 29 '13 at 07:00
  • `intName = inputStreamName.read(ByteName);` I wrote something like this for reading data, Then I transferred `Bytes` to a `static String` and I tried show that `String` in a `TextView` but it doesn't work. –  Aug 29 '13 at 07:13
  • And I wrote something like `outputStreamName.write(ByteName);` and then `outputStreamName.flush();` –  Aug 29 '13 at 07:15
  • I don't think I can be of any use to you in that regard.I have the same problem:[link](http://stackoverflow.com/questions/18431424/unable-to-communicate-with-elm327-bluetooth) – Flame of udun Aug 29 '13 at 07:52
  • You actually helped me to find the solution –  Aug 30 '13 at 18:45