All Questions
Tagged with android-ble bluetooth-lowenergy
168
questions
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....
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 ...
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....
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 ...
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 ...
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) ...
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) ...
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)
{
...
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.
...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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:
...
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?
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 ...
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 ...
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 ...
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() {
@...
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 ...
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 ...
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 ...
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 ...
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 ...
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) {...
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'.
...
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 ...
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(
...
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 ...
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, ...
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 ...
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 ...
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 ...
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". ...
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 ...
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 ...
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 ...
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...
...
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 ...
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....
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...