I don't think ports matter in this case. In fact, I don't need ports. 
Thanks anyway.
 
*BEWARE: Wall of text*
 
I have now narrowed down my problem, hopefully reaching a conclusion soon. 
I'm having trouble with fetching one single UUID for two devices to use. 
Here's a picture of what I have logged by using android.util.Log.
 
<http://i.imgur.com/t1QhdSk.png>
 
Here I have two devices, namely HTC #1 and HTC #2, both of them running 
Android 2.3.5. Each device has my app installed and debugged at the moment. 
The app fetches a UUID from the other remote device using reflection 
method, invoking Bluetooth.getUuids(). (i.e.: Device #1 fetches a UUID from 
Device #2, while Device #2 fetches a UUID from Device #1.)
 
The UUID for both devices are shown in the red box. According to this 
answer here <http://stackoverflow.com/a/14757884/1016891>, it said I need 
to use the same UUID for use with
BluetoothAdapter.listenUsingRfcommWithServiceRecord() and 
BluetoothDevice.createRfcommSocketToServiceRecord().
 
However, I realized that using the same UUID that was pre-fetched using 
BluetoothDevice.getUuids() 
w/ reflection for both BluetoothServerSocket.accept() and 
BluetoothSocket.connect() is wrong. Either I have to use UUID.randomUUID() 
or BluetoothDevice.getUuids() w/ reflection in order to obtain a UUID. It 
doesn't matter if it's randomly-generated, or fetched from a remote device, 
I have to obtain a UUID from some place, don't I?
 
Below is the sectors of my application. The Accept and Connect sectors 
implement the Runnable interface.
 

<http://i.imgur.com/SsWMUwR.png>
It probably doesn't relate to the main problem at hand, but it shows how I 
was doing with the obtained UUID. The UUID is used in the Accept and 
Connect sectors, where it handles BluetoothServerSocket.accept() and 
BluetoothSocket.connect(), respectively.
 
*Now, summarizing the narrowed problem: What can I do in order to obtain 
the same UUID for two devices? *The code below doesn't work:
 

<http://i.imgur.com/M5k0u5r.png>
The variable, localData, is null after executing. What am I after? I'm 
trying to obtain the same UUID from one device (i.e.: Device #1), in which 
all other devices (i.e.: Device #2, Device #3, etc.) can also fetch after, 
and use it to connect to the first device (i.e.: Device #1).
 
 
 
 
 
 
 
 
 

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to