title: Finding UUIDs in Android 2.0
body: <p>I am writing a program which needs to be run in Android 2.0. I am currently trying to connect my android device to an embedded bluetooth chip. I have been given information as to use fetchuidsWithSDP(), or getUuids(), but the page I read explained that these methods are hidden in the 2.0 SDK, and must be called using reflection. I have no idea what that means and there is no explanation. There is example code given, but very little explanation behind it. I was hoping someone could help me understand what is actually going on here, as I am very new to Android development. </p>
  
  <pre><code>String action = "android.bleutooth.device.action.UUID";
  IntentFilter filter = new IntentFilter( action );
  registerReceiver( mReceiver, filter );
  </code></pre>
  
  <p>The page I read also says that in the first line bluetooth is spelled "bleutooth" on purpose. If anyone can explain that, I would appreciate that as well as it makes no sense to me, unless the developers made a typo.</p>
  
  <pre><code>private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
  @Override
  public void onReceive( Context context, Intent intent ) {
      BluetoothDevice deviceExtra = intent.getParcelableExtra("android.bluetooth.device.extra.Device");
      Parcelable[] uuidExtra = intent.getParcelableArrayExtra("android.bluetooth.device.extra.UUID");
  }
  </code></pre>
  
  <p>};</p>
  
  <p>I am having trouble grasping how exactly I find the correct UUID for my embedded bluetooth chip. If anyone could help it'd be greatly appreciated.</p>
  
  <p>EDIT: I am going to add the rest of my onCreate() method so you can see what I'm working with. </p>
  
  <pre><code> public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      // Set up window View
      setContentView(R.layout.main);
  
      // Initialize the button to scan for other devices.
      btnScanDevice = (Button) findViewById( R.id.scandevice );
  
      // Initialize the TextView which displays the current state of the bluetooth
      stateBluetooth = (TextView) findViewById( R.id.bluetoothstate );
      startBluetooth();
  
      // Initialize the ListView of the nearby bluetooth devices which are found.
      listDevicesFound = (ListView) findViewById( R.id.devicesfound );
      btArrayAdapter = new ArrayAdapter&lt;String&gt;( AndroidBluetooth.this,
              android.R.layout.simple_list_item_1 );
      listDevicesFound.setAdapter( btArrayAdapter );
  
      CheckBlueToothState();
  
      // Add an OnClickListener to the scan button.
      btnScanDevice.setOnClickListener( btnScanDeviceOnClickListener );
  
      // Register an ActionFound Receiver to the bluetooth device for ACTION_FOUND
      registerReceiver( ActionFoundReceiver, new IntentFilter( BluetoothDevice.ACTION_FOUND ) );
  
      // Add an item click listener to the ListView
      listDevicesFound.setOnItemClickListener( new OnItemClickListener()
      {
        public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1,int arg2, long arg3) 
        {
            // Save the device the user chose.
            myBtDevice = btDevicesFound.get( arg2 );
  
            // Open a socket to connect to the device chosen.
            try {
                btSocket = myBtDevice.createRfcommSocketToServiceRecord( MY_UUID );
            } catch ( IOException e ) {
                Log.e( "Bluetooth Socket", "Bluetooth not available, or insufficient permissions" );
            } catch ( NullPointerException e ) {
                Log.e( "Bluetooth Socket", "Null Pointer One" );
            }
  
            // Cancel the discovery process to save battery.
            myBtAdapter.cancelDiscovery();
  
            // Update the current state of the Bluetooth.
            CheckBlueToothState();
  
            // Attempt to connect the socket to the bluetooth device.
            try {
                btSocket.connect();                 
                // Open I/O streams so the device can send/receive data.
                iStream = btSocket.getInputStream();
                oStream = btSocket.getOutputStream();
            } catch ( IOException e ) {
                Log.e( "Bluetooth Socket", "IO Exception" );
            } catch ( NullPointerException e ) {
                Log.e( "Bluetooth Socket", "Null Pointer Two" );
            }
        } 
    });
  }
  </code></pre>