All Questions

Filter by
Sorted by
Tagged with
15 votes
3 answers
3k views

BluetoothGattServer cancelConnection does not cancel the connection

I have Android application which exposes BLE Server. I connect with BluetoothGattServer#connect. It works - my app gets call to BluetoothGattServerCallback#onConnectionStateChange with STATE_CONNECTED....
Marian Paździoch's user avatar
14 votes
1 answer
3k views

Android Companion device pairing: how to use REQUEST_COMPANION_RUN_IN_BACKGROUND permission?

I'm currently testing Android companion device pairing and I'm not sure how to benefit from the REQUEST_COMPANION_RUN_IN_BACKGROUND permission. In one part of Google documentation is says: After the ...
Jan Slominski's user avatar
12 votes
2 answers
7k views

What is the max concurrent Ble connections android M+ can have

My app required to connect 9 Ble devices concurrently. In this article and any other resource it write that android 4.4+ can connect only to 7 devices. Is there anything new in M or N versions? Thanks....
Maor Hadad's user avatar
  • 1,872
8 votes
2 answers
5k views

Scanning for BLE peripherals with a scan filter based on advertised service UUID

I have a custom BLE peripheral that advertises data like this: In other words, my BLE peripheral advertises a service UUID associated with a unique identifier in advertised service data, but it does ...
Sebastien's user avatar
  • 3,782
8 votes
0 answers
1k views

Android BLE device scan with device name filter is not working

I am using device name filter to connect to a specific BLE device. But my scan call back is not executing. It works fine when I use MAC address as filter. Is this a known issue or bug? I am testing on ...
sa_penguin's user avatar
7 votes
4 answers
7k views

Disconnecting a BluetoothDevice without BluetoothGATT

My app talks to a BLE peripheral. Sometimes the app is started with that peripheral already connected. I can retrieve the device by calling: BluetoothManager manager = (BluetoothManager) ...
James Whong's user avatar
7 votes
2 answers
4k views

Reacting to BLE directed advertising (ADV_DIRECT_IND) in Android

How to react to directed advertising (ADV_DIRECT_IND == 0001) in Android? There is a BLE-gadget which sends directed advertising to an Android phone (using hardcoded MAC address of the phone for now) ...
Alexander Farber's user avatar
6 votes
1 answer
10k views

Android BLE readCharacteristic fails

I'm trying to read the initial state of a BLE device when I connect to it. Here's the code I have to try to do that: @Override public void onServicesDiscovered(BluetoothGatt gatt, int status) { ...
CaseyB's user avatar
  • 24.9k
6 votes
3 answers
2k views

I want to identify the BLE wheel and crank sensor data from the 11-bytes data from a mobile application we have developed

I want to identify the wheel and crank sensor data from the 11-bytes data. I have tried to parse the 11-bytes hex data which i got in our mobile application as per the split ups in the link below. ...
Santosh Krishnan's user avatar
5 votes
1 answer
9k views

android - stopLeScan() & startLeScan() deprecated in API Level 22 - How do I go about replacing this with stopScan() and startScan()?

I see that stopLeScan() & startLeScan() are deprecated in Android 5.1.1. I am having issues replacing my stopLeScan() & startLeScan() methods. Here is my following code: @Override protected ...
user268397's user avatar
  • 1,917
5 votes
1 answer
3k views

How to make a BLE connection that is connected using service to use across the activities without stopping the service or disconnecting ble?

I have 3 components. Activity1 has button for connecting and disconnecting the BLE Connection Activity2 Needs to Get the data from the BLE Device. Service All the connection logic (like ...
Dinesh Ravi's user avatar
  • 1,225
5 votes
2 answers
925 views

Android Bluetooth LE SCAN_FAILED_OUT_OF_HARDWARE_RESOURCES

In my Android (API version 21 and above) Bluetooth LE app, the app starts by scanning for the peripheral using a BluetoothLeScanner and a ScanCallback object. This works fine the first few times the ...
idrougge's user avatar
  • 661
5 votes
2 answers
6k views

How do I make sure app is disconnecting from a Bluetooth LE device?

I have two devices that I'm connecting to. When I leave the app I'm disconnecting from the devices. Both go through the same process but sometimes one of the devices maintains a connection until I ...
Jeff Engebretsen's user avatar
5 votes
1 answer
2k views

Android Ble disconnect time delay

I wrote some code to connect my android phone to a ble device. When I power off the ble device my phone takes a few seconds (2-20s) to notify me that it has lost connection to the ble device. Is ...
jhon snow's user avatar
5 votes
1 answer
3k views

bluetoothGatt writeCharacteristic returns false

I created a peripheral with a WRITE_TYPE_NO_RESPONSE characteristic. With another application, I wrote on characteristic, but I have an occasional problem with samsung galaxy nexus i9250 with lollipop ...
aeroxr1's user avatar
  • 1,064
4 votes
2 answers
5k views

What is ENABLE_INDICATION_VALUE and ENABLE_NOTIFICATION_VALUE in Client Characteristic Configuration Descriptor in ble?

I have been working on an app to read and write data from another BLE device. I don't have any issues going on from the app point of view. Just some of the conceptual doubts I need to clarify. So: ...
Animesh Jena's user avatar
  • 1,541
4 votes
3 answers
8k views

Open source implementations of BLE stack

Are there any open source implementations of BLE stack other than BlueZ and Bluedroid?
user299012's user avatar
4 votes
2 answers
5k views

Sending Large File via BLE API on android

I have created BLE sender class for the sending large ByteArray via Bluetooth LE The logic of the send process following: Write descriptor to enable notification on characteristics that sends data ...
libinm's user avatar
  • 81
4 votes
1 answer
4k views

Bluetooth GATT onConnectionState Change does not work on Lollipop

I currently have a method which writes to the BLE devices to beep it. My Bluetooth Callback goes as follows : public class ReadWriteCharacteristic extends BluetoothGattCallback { public ...
Shashank Hebbale's user avatar
4 votes
2 answers
2k views

how to define SampleGattAttributes in the following code?

public final static UUID UUID_HEART_RATE_MEASUREMENT = UUID.fromString(SampleGattAttributes.HEART_RATE_MEASUREMENT); SampleGattAttributes, appears in red colour,means unresolved ...
mithun's user avatar
  • 121
4 votes
1 answer
801 views

Android - BLE bonding programmatically doesn't work on all CoolPad Note 3

I am using below broadcast receiver to catch bond request and bond it without user popup request. private static BroadcastReceiver pairingBroadcastReceiver = new BroadcastReceiver() { @...
Ijas Ahamed N's user avatar
4 votes
1 answer
2k views

How to test BLE objects on Android?

I am learning to communicate over Bluetooth Low Energy on Android.. Here is an example app There in there source code are several Bluetooth related objects, which were final classes obviously: private ...
Ralf Wickum's user avatar
  • 3,062
4 votes
1 answer
3k views

How can I advertise via BLE 100 bytes?

How can I advertise via BLE 100 bytes? SDK >= 26 I am able to advertise 20 bytes, but when I advertise more than 20 bytes, I get an Exception. I have already read these articles: Android: Sending ...
Ponomarenko Oleh's user avatar
4 votes
1 answer
786 views

Android BLE startDiscovery() callback is not fired even with Location permissions

The app is targeted to 22 with minimum version 18 and works as expected on Lollipop. Starting Marshmallow apps need to require 'fine' and 'coarse' permissions for BLE. I've added them but the callback ...
4ntoine's user avatar
  • 20.1k
4 votes
0 answers
196 views

How do I avoid requesting BLE scan response?

I have a mobile app (android & iOS) that scans for peripherals with a filter by service UUID. I noticed a degradation in discoverability when multiple centrals scan at the same time. I assume this ...
Anton Epple's user avatar
4 votes
0 answers
3k views

How to create Bluetooth L2CAP connection between two devices?

Android 10 released support for BLE CoC connection so I wanted to try this out by making two simple android 10 apps, which would connect to each other with l2Cap and exchange "Hello World". I wrote ...
Nikola Maksimovic's user avatar
3 votes
3 answers
25k views

How to correctly use UUID.fromString method?

I am trying to read/write these ble characteristics: Right now, I'm trying to read AA01* I am using this library to do it. Here's my code: private void connectToSensorTag(RxBleDevice rxBleDevice) {...
Guy's user avatar
  • 6,483
3 votes
1 answer
4k views

Getting Type_Gatt_Error with status 133 while connecting to AND UA651BLE

I am trying to connect to AnD UA-651BLE blood pressure monitor and get the values in an android app. The app is able to find the device but I am getting Type_Gatt_Error in 'onConnectionStateChange'. ...
Roohi Zuwairiyah's user avatar
3 votes
1 answer
2k views

BLE Advertise data size limit

On My Addroid app I'm trying to add some extra data when I try to start ble advertising, and as I've read, advertise data must be <= 31 bytes. That's how I do it: var testData = "abcdefghij" var ...
giozh's user avatar
  • 9,998
3 votes
1 answer
2k views

Android BluetoothGatt not receving Characteristic Notifications BluetoothGatt#writeDescriptor(desc) return false

I am working on an application which needs to communicate with a Bluetooth LE device. This is the code I use to set the CharacteristicNotification public boolean setCharacteristicNotification( ...
Varun Narisetty's user avatar
3 votes
2 answers
1k views

The device GattServer stops advertising after connecting to it

This is the link to the GATT Server sample for Android Things on GitHub: https://github.com/androidthings/sample-bluetooth-le-gattserver Setting up the server on RPi-3 is easy enough. What I do not ...
Ove Stoerholt's user avatar
3 votes
1 answer
8k views

onCharacteristicWrite() is being called, but it doesn't always write

I have a custom piece of hardware with a bluetooth low energy chip. I have set it up with an array with 500 u32s such that array[n] == n. I'm working on an android app that can connect to the device, ...
spurrkins's user avatar
  • 126
3 votes
1 answer
515 views

increase Android BLE bonding / pairing dialog timeout

I have an android app that connects to a BLE device and pairs with it using BleDevice.createBond(). the issue is that the dialog could disappear before the user noticing it. here is a screenshot of ...
Remon Shehatta's user avatar
3 votes
1 answer
557 views

Android: Why is BluetoothLeScanner sometimes not discovering any BLE device?

I'm using BluetoothLeScanner to scan for BLE devices, which I start using: startScan(null, settings.getScanSettings(), scanCallback); Every once in a while, a call to startScan() does not discover any ...
matdev's user avatar
  • 4,225
3 votes
0 answers
310 views

Android BLE DFU multiple devices update one after another...But some devices fails to update

By using nordic Dfu library (updated) I have to update firmware of devices in one go,I have mac addresses of devices which required to update, let say i have 30 devices with their mac addresses and ...
Tasawar Khaliq's user avatar
3 votes
1 answer
2k views

WiFi connection issues when BLE scan always on

I'm currently scanning BLE devices continuosly and undefenetily, but I noticed that my Samsung J1 loose wifi connections, and any atempt to reconect gives "Authentication Error":"Password incorrect". ...
Marcos Vasconcelos's user avatar
3 votes
0 answers
208 views

Android BLE receive STATE_DISCONNECTED while the device is still connected

I am developing Android app that connects with BLE device using native BLE API. Many times I receive STATE_DISCONNECTED in the BluetoothGattCallback while the bluetooth device is still connected and ...
Amani Elsaed's user avatar
  • 1,568
3 votes
0 answers
571 views

BLE - How to get response after writing command?

I have a BLE device with a "particular protocol". I need to send a command to retrieve heart rate measurements (using notifications). My question is: how can I get response after write the "send ...
eldivino87's user avatar
  • 1,435
3 votes
1 answer
1k views

Android BLE Error 0x06 Request Not Supported

My app is facing issue while connecting to BLE device. On every connection attempt app makes, it gets Error code 0x0006(Request not supported) in OnConnectionStateChange() method. I have tried ...
Alina's user avatar
  • 130
3 votes
1 answer
599 views

Android 4.4 BLE Scanning lack of stability

Would a Bluetooth LE Jedi know any trick how to get a reliable BLE scanning mode on cheap Android 4.4 devices ? Everything works fine from Android 5 to 6, and most of the Android 4.4 phones... ...
JBA's user avatar
  • 2,899
2 votes
1 answer
917 views

BLE's - onCharacteristicRead not invoked on calling readCharacteristic

I'm trying to read a value from a custom characteristic in a custom service on a BLE device. I successfully call the readCharcteristic method as it returns true. However, the onCharacteristicRead ...
K K's user avatar
  • 73
2 votes
1 answer
487 views

Companion device pairing: how long does it take the scan to stop?

I am using Companion device pairing and followed this guide. when I try to associate to a device like that deviceManager.associate(pairingRequest,callbacks) it will start scanning for BLE devices. 1....
Remon Shehatta's user avatar
2 votes
1 answer
1k views

How to make Android connect after the Bluetooth Adapter has been disabled & reenabled?

I have written an app that connects to a BLE device. The app works OK on most devices; but some devices (most noticeably Huawei P8 Lite and Nexus 6P) refuse to connect after the Bluetooth adapter has ...
millibit's user avatar
  • 175
2 votes
1 answer
2k views

BluetoothServiceJni: An exception was thrown by callback 'btgattc_notify_cb'

I am using Android ble to develop an application. The app will connect with the external device using ble. The external device has a sensor that records data and as soon as the android device comes in ...
Saurabh's user avatar
  • 434
2 votes
1 answer
791 views

Get the supported Bluetooth Version in Android phones?(5 or 4.x)

Is there a way to know the Android Bluetooth Ver?( 5 or 4.x - 4.1 or 4.2?) Currently as per https://developer.android.com/about/versions/oreo/android-8.0-changes Feature like Advertisement packet ...
Raulp's user avatar
  • 7,968
2 votes
1 answer
6k views

Scanning for BLE devices on Android 8+ in the background

I'm using the following method from BLE scanner API on Android 8+ to scan for BLE Beacons startScan(List<ScanFilter> filters, ScanSettings settings, PendingIntent callbackIntent) The problem ...
Metwalli's user avatar
  • 1,861
2 votes
2 answers
3k views

Maximum no of device that can connect to BLE(BluetoothGattServer) server android

Does anybody knows the maximum number of device that can be connected to ble peripheral ? I tried with two devices and it connects well but the third device is not able to connect to Android BLE ...
DAMM108's user avatar
  • 960
2 votes
1 answer
16k views

Using BLE - Read GATT characteristics

I'm trying to read GATT characteristic values from a Bluetooth LE device (a Heart Rate bracelet). Its specs are: Services Characteristics I have not yet figured out how to "read" the specifications ...
eldivino87's user avatar
  • 1,435
2 votes
2 answers
2k views

How to connect with BLE device for first time (Android)

I was going through BluetoothGatt.java and found the method boolean connect(Boolean autoConnect, BluetoothGattCallback callback, Handler handler) The documentation just above this method ...
Saurabh's user avatar
  • 434
2 votes
1 answer
529 views

How can I use semaphore to do a correct android ble communication?

I have one doubt with ble communication from my Android app and one peripheral. This peripheral sends data through notify on a certain characteristics "A" and I can write on it on another certain ...
aeroxr1's user avatar
  • 1,064