Here is some code I wrote attempting to do SDP on devices that have not been paired with (result is that getUuids() returns null because the device's UUIDs are not in the Android Bluetooth cache)
filter = new IntentFilter(BluetoothDevice.ACTION_UUID);
gobbedWebView.parentActivity.registerReceiver(mReceiver, filter);
// Must wait for the discovery method to finish before calling another method.
// (Methods cannot be run in parallel.)
// http://stackoverflow.com/questions/14812326/android-bluetooth-get-uuids-of-discovered-devices
} else if (BluetoothDevice.ACTION_UUID.equals(action)) {
/*if (Build.VERSION.SDK_INT >= 15 && dev.getUuids() == null) { // API 15: Icecream MR1
// If you have never attempted to pair or connect with the device, UUIDs will
// not be cached.
if (!dev.fetchUuidsWithSdp()) {
Log.w(TAG, "fetchUuidsWithSdp() returned false. Sanity check failed?");
}
}*/
Log.w(TAG, "ACTION_UUID:");
BluetoothDevice dev = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
Log.w(TAG, "ACTION_UUID: " + dev.getAddress());
boolean isNewDev = mDeviceList.put(dev.getAddress(), dev) == null;
gobbedWebView.runJsCallbacks("bluetooth", isNewDev ? "addCb" : "devCb",
findDevIndex(dev));
Here is some code I wrote attempting to do SDP on devices that have not been paired with (result is that getUuids() returns null because the device's UUIDs are not in the Android Bluetooth cache)