Alex Ferents
Alex Ferents

Reputation: 298

What is bluetooth uuid ? and how do i get it?

I am tring to connect my app to server with bluetooth. but i dont know what is this uuid and how should i find it?

class ConnectThread extends Thread {

        private final BluetoothSocket mmSocket;
        private final BluetoothDevice mmDevice;

            // Get a BluetoothSocket to connect with the given BluetoothDevice
            try {
                // MY_UUID is the app's UUID string, also used by the server code
                tmp = device.createRfcommSocketToServiceRecord(MY_UUID);

/// this gives me an error, how shoud i fix it?

Upvotes: 1

Views: 3416

Answers (1)

SunGa
SunGa

Reputation: 231

If you are using BluetoothChat source code, then, locate UUID in file BluetoothChatService.java as shown below:

public class BluetoothChatService {
    .
    .
    // Unique UUID for this application
    private static final UUID MY_UUID_SECURE =
    UUID.fromString("fa87c0d0-afac-11de-8a39-0800200c9a66");
    private static final UUID MY_UUID_INSECURE = 
    UUID.fromString("8ce255c0-200a-11e0-ac64-0800200c9a66");
    .
    .

Upvotes: 1

Related Questions