All Questions
Tagged with android-ble android-bluetooth
110
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 ...
13
votes
4
answers
24k
views
Android BLE Gatt connection change statuses
I have an android app to connect to a BLE device and write to it. I can successfully connect, read and write to it. As a part of testing, we are trying different disconnection scenarios.
Sometimes, if ...
12
votes
2
answers
13k
views
Android stops finding BLE devices: onClientRegistered() - status=133 clientIf=0
I am developing an app in which I can both find and configure BLE devices. I am using standard Android BLE API, but recently I've encountered some strange problems.
When I turn on my app the BLE ...
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
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
6
answers
2k
views
Android BLE onScanResult is never called in the background on Android 11. Was working on Android 10
I have an app which scans for BLE devices. It was working perfectly on Android 10, but since I updated my phone to Android 11, the onScanResult just never gets called if I put the application to the ...
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
2
answers
902
views
Android Bluetooth (BLE) corrupted data on onCharacteristicChanged
My app do the following:
It sends a command with onDescriptorWrite to the BT device.
As soon the BT device gets this command it starts transferring data to the Android phone.
Android's ...
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
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
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
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
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 ...
4
votes
2
answers
704
views
Android BLE characteristic read/Write failed in Lollipop but worked in Kitkat
As per title i am able to do read/write data successfully in below lollipop but in lollipop many times i am getting read/write fails.
this is how i am doing read/write data:
boolean isRead= ...
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
2
answers
4k
views
Android bluetooth get the heart rate measurement
I want to get the value of the HRM of an "A&D UA-651BLE" device.
this is what's written in the datasheet of this device to get the HRM value:
Set the application to pairing mode to start ...
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
3k
views
How to detect whenever my android device gets connected/disconnected from paired bluetooth device
I would like to receive an event for detecting whenever bluetooth gets paired or unpaired in my device.
In the beginning i found http://developer.android.com/reference/android/bluetooth/...
3
votes
2
answers
576
views
How do I effectively read temperature from two BLE devices at the same time?
First of all, I am using RxAndroidBLE library to manage my BLE connections.
I have two SensorTag devices and I want to read temperature from both at the same time. For example, I'd like to read the ...
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
3k
views
Why can't use Bluetooth and Wifi simultaneously?
This is hardware related question. But also software related.
I am making an Android app using bluetooth. And I tested my devices with wifi and bluetooth.
And the result is:
1. Wifi ON, connected &...
3
votes
0
answers
324
views
What does warning "BluetoothRemoteDevices: Skip name update" mean?
My app scans for Bluetooth devices.
When the app's Bluetooth scanner is scanning, it generates a lot of the following warnings
W/BluetoothRemoteDevices: Skip class update for AB:CD:12:34:56:78
...
3
votes
1
answer
1k
views
Turning off Bluetooth Adapter not calling onConnectionStateChange Android 8.1.0
Turning off the bluetooth in Android system settings gives us the BluetoothGattCallback.onConnectionStateChange() call in Android < 27 (Oreo). However when I try it on my Pixel or Nexus 5X (Android ...
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
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 ...
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
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
4k
views
Getting Response for Android BLE Write Characteristic
I am invoking the writeCharacteristic both using the WRITE_TYPE_NO_RESPONSE and without it.Am I supposed to get the response out of both or one or none?
Is there any callback to catch this response?
...
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
1k
views
Logging scanResult in Polidea - RxAndroidBle Scanning
I am trying to use the RxAndroidBle lib (https://github.com/Polidea/RxAndroidBle). I want the app the start and scan for BLE devices. I want to print the found devices in the LogCat. How can I do this?...
2
votes
2
answers
577
views
Companion device pairing: how to filter using UUID?
I am using Companion device pairing and followed this guide.
I want to scan for devices and filter them using UUID. I tried the following
val deviceFilter: BluetoothLeDeviceFilter = ...
2
votes
0
answers
2k
views
Android BLE Gatt Connection Issue (Connection Timeout Status:8)
I'm developing an Android app that discovers and connects to a GATT service that is being advertised by my rPi 3B+. The iOS app that I've finished developing works without any issue. However, almost ...
2
votes
0
answers
462
views
Get any error code on connect failure due to max connections limit reached on Android BLE
I am connecting to a BLE device and want a specific error code that could help me determine the reason of connection failure.
Scenario i want to cover is for maximum connections limit being reached.
...
2
votes
0
answers
914
views
Android BluetoothGatt.getServices(xyz) in onServicesDiscovered returns null for Service xyz listed in onScanResult ScanRecord.getServiceUuids()
I've been doing BLE on Android since 2013/API18/4.3.
I know what I am doing, but I can't figure out this simple problem.
I am successfully scanning BLE devices and in ScanCallback.onScanResult(...) I ...
2
votes
1
answer
716
views
Android BLE read data rate is slow when device is paired
I am developing an Android BLE app which sends multiple read requests per second (~ 10 samples/second). I have noticed that when the ble device is paired (bonded) to the phone, the reading rate is ...
2
votes
0
answers
2k
views
How to get BluetoothGattCharacteristic value format type?
While developing an application for IOT tried communicating with a BLE peripheral device. Using BLE Lollipop API.
Each BluetoothGattService can provide different BluetoothGattCharacteristic, each ...
2
votes
1
answer
1k
views
Android BluetoothDevice connectGatt not working on HTC M8 with Android 6.0
I have a BLE app that has hundreds of happy users on a variety of devices. Most of my testing has been done on Nexus devices, but a user reported an issue with HTC M8 so I just bought one. Sure enough,...
2
votes
0
answers
1k
views
Galaxy s6 Android LL: onConnectionStateChange return me 133 Error Status
I have developed an app that it have to reconnect to a server app that is installed on a certain device. I have tested my app on some device, but on galaxy s6 with Lollipop I have some problem.
This ...
1
vote
3
answers
1k
views
How to Send an Audio HEX file to Ble Device
I have a working ble device with android .
it sends and receives data finely through the Android app.
But Now My Problem is I want to send Some Audio HEX files to my BLE Device.
And its larger Than ...
1
vote
2
answers
3k
views
Queue Android Gatt operations
I made a app the connects to a ble device and receives data from it. I was following this link "http://toastdroid.com/2014/09/22/android-bluetooth-low-energy-tutorial" at the Hints and observation ...
1
vote
1
answer
1k
views
Android - What API can I use to see if a device supports BLE central mode?
https://developer.android.com/guide/topics/connectivity/bluetooth-le#roles
Central vs. peripheral. This applies to the BLE connection itself. The
device in the central role scans, looking for ...
1
vote
3
answers
2k
views
BLE Scan Freezes UI thread after 20 mins
I am trying to scan BLE devices continuously for a research project. I use LOW_LATENCY mode of BLE scanning. However, after 20 mins or so my UI freezes.
Basically I press button it should start ...
1
vote
2
answers
1k
views
BleGattException when writing to a particular characteristic
Writing to a specific characteristic crashes the application and throws the following exception:
Caused by: BleGattException{status=8, bleGattOperation=BleGattOperation{description='...
1
vote
1
answer
1k
views
Android BLE Scan - Cannot start unfiltered scan in screen-off
I am facing issue related to BLE advertisement scanning. After turning screen off my scanning is working for undefined time then stopping till I turn screen on. BtGatt.ScanManager is logging "...
1
vote
1
answer
3k
views
On start scan BluetoothLeScanner app crashes and no results are displayed
The error message I see is:
Attempt to invoke virtual method 'void android.bluetooth.le.BluetoothLeScanner.startScan(java.util.List, android.bluetooth.le.ScanSettings, android.bluetooth.le....
1
vote
4
answers
3k
views
ScanCallback onBatchScanResults is getting called indefinitly
I am trying to scan for BLE devices once I find my device or after 10 sec, I am trying to stop the scan. But for some reason the onBatchScanResults is getting called indefinitely.
I found that even ...
1
vote
2
answers
1k
views
How to disable a notification with rxandroidble?
I'm currently trying to use rxandroidble in order to replace the native BLE API of Android of one of our app.
How to disable a notification? I'm able to enable it with the sample code, this one:
...