Android: How do bluetooth UUIDs work?

The UUID is used for uniquely identifying information. It identifies a particular service provided by a Bluetooth device. The standard defines a basic BASE_UUID: 00000000-0000-1000-8000-00805F9B34FB. Devices such as healthcare sensors can provide a service, substituting the first eight digits with a predefined code. For example, a device that offers an RFCOMM connection uses the short … Read more

IOException: read failed, socket might closed – Bluetooth on Android 4.3

I have finally found a workaround. The magic is hidden under the hood of the BluetoothDevice class (see https://github.com/android/platform_frameworks_base/blob/android-4.3_r2/core/java/android/bluetooth/BluetoothDevice.java#L1037). Now, when I receive that exception, I instantiate a fallback BluetoothSocket, similar to the source code below. As you can see, invoking the hidden method createRfcommSocket via reflections. I have no clue why this method is … Read more

How to enable/disable bluetooth programmatically in android

this code worked for me.. //Disable bluetooth BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (mBluetoothAdapter.isEnabled()) { mBluetoothAdapter.disable(); } For this to work, you must have the following permissions: <uses-permission android:name=”android.permission.BLUETOOTH”/> <uses-permission android:name=”android.permission.BLUETOOTH_ADMIN”/>

Location needs to be enabled for Bluetooth Low Energy Scanning on Android 6.0

No, this is not a bug. This issue was brought up to Google where they responded saying that this was the intended behavior and they won’t fix it. They directed developers to this site where it points out that location permission is now needed for hardware identifier access. It is now the developer’s responsibility to … Read more

Understanding ibeacon distancing

The distance estimate provided by iOS is based on the ratio of the beacon signal strength (rssi) over the calibrated transmitter power (txPower). The txPower is the known measured signal strength in rssi at 1 meter away. Each beacon must be calibrated with this txPower value to allow accurate distance estimates. While the distance estimates … Read more

Android 4.3 Bluetooth Low Energy unstable

Important implementation hints (Perhaps some of those hints aren’t necessary anymore due to Android OS updates.) Some devices like Nexus 4 with Android 4.3 take 45+ seconds to connect using an existing gatt instance. Work around: Always close gatt instances on disconnect and create a fresh instance of gatt on each connect. Don’t forget to … Read more

Bluetooth headphone music quality deteriorates when launching iOS simulator

I’ve managed to fix it, and it actually seems to be a microphone issue. Go to System Preferences -> Sound, select the Input tab and set Internal Microphone as the input (mine was set with my headphones’). Crappy sound goes way after that =) EDIT (May 30 2018): I’ve found out an easier way to … Read more