Android Bluetooth Low Energy Pairing

When you get the GATT_INSUFFICIENT_AUTHENTICATION error, the system starts the bonding process for you. In the example below I’m trying to enable notifications and indications on glucose monitor. First I’m enabling the notifications on Glucose Measurement characteristic which can cause the error to appear. @Override public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { if … Read more

Android 4.3: How to connect to multiple Bluetooth Low Energy devices

I suspect everyone adding delays is just allowing the BLE system to complete the action you have asked before you submit another one. Android’s BLE system has no form of queueing. If you do BluetoothGatt g; g.writeDescriptor(a); g.writeDescriptor(b); then the first write operation will immediately be overwritten with the second one. Yes it’s really stupid … Read more

Turn Macbook into iBeacon

Note: This only works in Mavericks, it does NOT work in Yosemite. Mavericks doesn’t have the iBeacon support in Core Location that was added to iOS 7. However, Mavericks does now have the ability to act as an BLE peripheral device. Given that an iBeacon is basically a peripheral it should be (and indeed is) … Read more

startLeScan replacement to current api

Both methodsBluetoothAdapter.startLeScan and BluetoothAdapter.stopLeScan were deprecated in Android Lollipop. As a replacement BluetoothLeScanner were introduced and acting as a scan controller. If you develop BLE-based application you should control either scan via the BluetoothAdapter (Android 4.3 and Android 4.4) or the BluetoothLeScanner. The API introduced in Android Lollipop offers much greater features in terms of … Read more

Chipsets/Devices supporting Android 5 BLE peripheral mode

The Android 5.0.X will only allow you to use the new API for BLE. This new API comes with a new feature, which you mentioned in your question: The possibility of advertising, from your own Android device, using it in Peripheral mode. However, the disadvantaged of this new feature is that it is hardware dependent. … Read more

Combine iBeacon bluetooth low energy with Android 4.3

EDIT: The library below has been moved here: https://github.com/AltBeacon/android-beacon-library I have ported the iOS7 iBeacon SDKs to Android, and was able to see standard iBeacons and estimate their range. The code is available here: https://github.com/RadiusNetworks/android-ibeacon-service For this to work, you need Android 4.3 which introduced the Low Energy Bluetooth APIs. You also need a device … Read more

Programmatically pairing with a BLE device on Android 4.4+

I almost have it working. It pairs programmatically but I can’t get rid of the “Pairing request” notification. Some answers to this question claim to be able to hide it just after it is shown using the hidden method cancelPairingUserInput() but that doesn’t seem to work for me. Edit: Success! I eventually resorted to reading … Read more

‘App is scanning too frequently’ with ScanSettings.SCAN_MODE_OPPORTUNISTIC

Android 7 prevents scan start-stops more than 5 times in 30 seconds. The bad side is, it doesn’t return an error, instead just prints a log. The app thinks the scan is started but it’s not actually started back at the ble stack. Also it converts long running scans to opportunistic scan with an intent … Read more

Node.js – how to set environment variables in code

You can not only consume environment variables in node with process.env but also set them. This will set the variable within your current node process and any child processes it calls, but not the calling shell itself. // consume var alreadySetEnvVarForDevice = process.env.NOBLE_HCI_DEVICE_ID // set process.env[‘NOBLE_HCI_DEVICE_ID’] = 1

How to programmatically force bluetooth low energy service discovery on Android without using cache

I just had the same problem. If you see the source code of BluetoothGatt.java you can see that there is a method called refresh() /** * Clears the internal cache and forces a refresh of the services from the * remote device. * @hide */ public boolean refresh() { if (DBG) Log.d(TAG, “refresh() – device: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)