Questions tagged [android-ble]
In contrast to Classic Bluetooth, Bluetooth Low Energy (BLE) is designed to provide significantly lower power consumption. This allows Android apps to communicate with BLE devices that have low power requirements, such as proximity sensors, heart rate monitors, fitness devices, and so on.
                                	
	android-ble
    
                            
                        
                    
            275
            questions
        
        
            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
        
    Ble Android Advertising: AddServiceData
                on my ble project i'm trying to add some service data to advertise data like this
 var data = AdvertiseData.Builder().apply {
            setIncludeDeviceName(true)
            addServiceData(
       ...
            
        
       
    
            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
        
        
            3k
            views
        
    onCharacteristicChanged() been called multiple times
                I am working with BLE connection in my app. I have a single class for the bluetooth functionalities and I am passing a command from a different fragment class for writing any value.
So based on the ...
            
        
       
    
            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
        
        
            5
            answers
        
        
            2k
            views
        
    BLE Device dissonect after receive Notifications (BLEGattException Status = 0x8)
                My BLE server permanently measures a sensor value and sends a notification with 20 byte user data after each measurement. The goal is to generate as much throughput as possible.
On the client side, ...
            
        
       
    
            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
        
        
            2
            answers
        
        
            1k
            views
        
    Can I have an encrypted BLE connection without bonding? / Pairing BLE devices without bonding
                So far I am able to do things two different ways.
I can advertise a service on the Pi, connect from an Android app, and read/write characteristics. From my understanding, this communication is not ...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            1k
            views
        
    How to convert byte array data to float data type in android app
                I am creating an app and have data coming in the function onCharacteristicChanged. The data I am getting is byte[]. I need to be able to take the data type and be able to have float numbers which are ...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            3k
            views
        
    Android BLE: Is it possible to add Service Data and Manufacturer Data at the same time when advertising an iBeacon packet?
                I'm currently doing an experiment in order to trigger a beacon detection device. Here is the sample of a detected beacon that can be used to trigger that device.
In my experiment, I'm trying to ...
            
        
       
    
            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
        
        
            2k
            views
        
    How do I format a byte array to be sent to a characteristic on a BLE device?
                I connect to my device and attempt to write to its characteristic:
scanSubscription = rxBleClient.scanBleDevices(
  ScanSettings.Builder()
  // .setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY) // ...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            126
            views
        
    ConcurrentModificationException in ScanJob from android-beacon-library
                I've an app scanning for BLE devices. In Crashlytics, I noticed the following crash:
Fatal Exception: java.util.ConcurrentModificationException
       at java.util.ArrayList$Itr.next + 860(ArrayList....
            
        
       
    
            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
        
        
            1
            answer
        
        
            1k
            views
        
    How to sync communication between BLE Central (Mobile) and Peripheral?
                I am working on a BLE app. I am through to establishing communication between Mobile app (CENTRAL - BluetoothGattClient) and PERIPHERAL (GATT SERVER) albeit not neatly.
PERIPHERAL has one service ...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            1k
            views
        
    RxAndroidBle - How to disconnect all connected devices?
                I am using awesome rxandroidble library for BLE control.
I keep connection between activities. 
Before I start scanning, I want to disconnect all connected devices first.
Sometimes It is not working ...
            
        
       
    
            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
        
        
            1
            answer
        
        
            409
            views
        
    android maximum regions to ranging and monitoring
                I want to track all nearby beacons using global region, then i create individual region for each ranged region from the global region, is there any regions limit for android phone ? i've read that in ...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            1k
            views
        
    Android BLE Peripheral Mode: custom characteristics not detected
                I am trying to implement a BluetoothGattServer on a Sony SmartWatch 3.
I can sucessfully open a Gatt server as well as advertise.
Using the BLE Scanner application, I have inconsistent results while ...
            
        
       
    
            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:
...
            
        
       
    
            1
            vote
        
        
            2
            answers
        
        
            8k
            views
        
    Reading from a BluetoothGattCharacteristic is failing
                Im trying to read the value stored in a BluetoothGattCharacteristic. The following is my BluetoothGattCallback code, where most of the action takes place:
 private final BluetoothGattCallback ...
            
        
       
    
            1
            vote
        
        
            2
            answers
        
        
            4k
            views
        
    BluetoothDevice always returns null on getName()
                I'm facing this issue consistently in Android 4.4, 5 and 6.
I'm performing a BLE Bluetooth devices scan and after it I can access their address (getAddress()), and other data. But if I call device....
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            162
            views
        
    Android Beacon Library version -- 2.3.5 not detecting TI senor tag
                Mobile device model and OS version -- Nexus 5, API 23
Android Beacon Library version -- 2.3.5
I have a sensor tag from TI(Texas Instruments), and the firmware is TI provided.  The same 2541 chipset is ...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            2k
            views
        
    Android BluetoothLEGatt BLE not staying connected to device
                I am running the sample BluetoothLeGatt app from google and having trouble keeping my device connected. I feel like I am having random behavior a little bit. The bluetooth doesn't usually doesn't ...
            
        
       
    
            1
            vote
        
        
            2
            answers
        
        
            2k
            views
        
    writeDescriptor(BluetoothGattDescriptor!): Boolean' is deprecated. Deprecated in Java
                I am working Bluetooth gatt with
minSdk 21
targetSdk 33
I see the writeDescriptor is deprecated in sdk 33. So I did this to wrap the code in SDK version check
 gatt.setCharacteristicNotification(...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            497
            views
        
    Why Android BLE gatt callback method onCharacteristicChanged callback is called in lower rate in Wear OS device than on smartphone?
                I develop an application designed for Wear OS devices that received data using BLE as Gatt client. I set the mtu size the maximum possible (517 bytes), and need to transfer some large amount of data - ...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            710
            views
        
    BLE scan callback not invoked on missing permission
                I am using Samsung Note 8 (Android 9) and Samsung A50(Android 10).
I am doing BLE scan which needs Bluetooth as well as location permissions (Android >=23). I am NOT providing the Location ...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            1k
            views
        
    Getting error "E/bt_btif:... ignore HID..." using Android BLE
                I'm trying to send data from my wearable device pushing a button to send a value to my phone but when I push the button I get the following error:
E/bt_btif: bta_gattc_process_indicate, ignore HID ...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            1k
            views
        
    How is nrfConnect able to send more than 20 bytes from android app to raspberrypi?
                I am trying to write a 120 byte data through ble to raspberrypi from my android app(I increased the MTU to the required limit). But all I am able to transfer is first 20 bytes. When I tried to search ...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            1k
            views
        
    How to initialize BluetoothGatt object in BLE?
                While looking at all examples all I see is to initialize BluetoothGatt object the way used is 
mGatt = device.connectGatt(activity, false, gattClientCallback);
Now how do I initialize the gatt ...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            932
            views
        
    GATT_REQUEST_NOT_SUPPORTED any more information available?
                I am writing an android app to communicate with a BLE device. The app is a recreation of an iOS version however any write request raises a GATT_REQUEST_NOT_SUPPORTED response inside ...
            
        
       
    
            1
            vote
        
        
            2
            answers
        
        
            756
            views
        
    Emit an item one at a time, interact with it until a condition is met, then continue for next item
                I have a list of BLE devices, and am using RxJava to interact with them. I need to emit an item from the list, write a characteristic to it repeatedly until X happens, and then proceed to the next ...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            3k
            views
        
    i want to know how i can get the UUID of BLE device which is needed to connect IOS app to BLE device in android, same as like vice-versa?
                Actually, I'm new in BLE, and In Android, if I am searching for available devices, so i got some Address, which is like, "8A:WS:YV:23:D7", and if i'm searching for the same device in IOS, then it ...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            296
            views
        
    3 thread running at high frequency uses the same variables
                I'm developing an android application that at high frequency receives data from ble notify, print data on the screen and send data to other peripherall. 
This is my situation :
...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            642
            views
        
    Android BLE connection disconnects
                I am writing an app that scans for ble devices then displays the results in a listview so the user can click on a device to connect. Im having two problems. One is when I stop the Scan and connect to ...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            326
            views
        
    How to extract a bit from a byte and display it on a textview, in Android?
                I am receiving a string data from a ble device. I stored it in String names
I need to extract a byte from its eighth position, then I need to extract all the bits from the byte.
How can I achieve ...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            126
            views
        
    How to Bluetooth LE background connection?
                Sorry for my bad English.
Context
My main goal is to build a electronic lock, the key would be a phone connected in BLE. The proximity of the phone must unlock the lock.
What I want to do
A ...
            
        
       
    
            1
            vote
        
        
            0
            answers
        
        
            130
            views
        
    android 12: missing BLE serviceUUIDs
                The sensors of are also bluetooth beacons with a custom (128 bit) serviceUUID.
This serviceUUID is sent as part of the scanResponse, not the advertisementData.
Doing a BLE scan with filtering by ...
            
        
       
    
            1
            vote
        
        
            2
            answers
        
        
            403
            views
        
    CompanionDeviceService gets destroyed right after creation
                I have simple activity with function that when called displays ble pairing request. After user confirms, startObservingDevicePresence("Some Mac address") is called. That successfully ...
            
        
       
    
            1
            vote
        
        
            0
            answers
        
        
            89
            views
        
    Is there any solutions available to send data from BluetoothGattServer to connected devices simultaneously?
                Here is my server code:
private BluetoothGattServer mGattServer;
mBluetoothLeAdvertiser = mBluetoothAdapter.getBluetoothLeAdvertiser();
GattServerCallback gattServerCallback = new GattServerCallback(...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            970
            views
        
    Android Ble Server - Allow only previously connected device to connect
                I have an android BLE client and an android BLE server.
After the initial connection, I want the server to allow only the previously connected client device to connect.
How to achieve this?
What I ...
            
        
       
    
            1
            vote
        
        
            0
            answers
        
        
            106
            views
        
    Is there a way to get the BluetoothAdapter address if I do not plan to publish the app on Google play?
                I am currently able to get the Bluetooth adapter mac address on devices with sdk from Marshmallow till Oreo.
However, starting Pie, the retrieved mac address is null.
The following method is working ...
            
        
       
    
            1
            vote
        
        
            0
            answers
        
        
            523
            views
        
    Android : UUID of Custom Service of my BLE peripheral is not finding
                One of My application is working as a Bluetooth peripheral, I add one Custom Service and 3 characteristics in it. My Client application after connected to peripheral discover its services, but UUID of ...
            
        
       
    
            1
            vote
        
        
            0
            answers
        
        
            110
            views
        
    scanForPeripherals reports dozens of random peripherals (one physical device)
                What Works: (prior to bonding scanForPeripherals reports 1x peripheral)
What doesn't: (once bonded, scanForPeripherals reports 10-30x peripherals instantly)
this happens instantly - the moment 'pair' ...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            990
            views
        
    Allow third party extensions/plugins for my Android app after installation - Bluetooth Low Energy
                I have looked at several posts in stack overflow related to this topic and the closest I can get is sharing data between APKs using content providers.
What I am looking to do is to first install my ...
            
        
       
    
            1
            vote
        
        
            0
            answers
        
        
            255
            views
        
    Android: Unable to scan for BLE devices even after using setEnableBle in LocationSettingsRequest
                In my app I want to search nearby users using both GPS and BLE. I came across the SettingsClient which is used to enable GPS by showing a Popup in case it isn't enabled.
Interestingly, it also has a ...
            
        
       
    
            1
            vote
        
        
            2
            answers
        
        
            2k
            views
        
    bluetoothGatt.writeCharacteristic always return false with ble characteristic type is write_no_reponse
                I am writing an Android app to talk with an BLE meter. I have been able to scan devices, connect to the target, discover services, get characteristics. However, when I try to write a write_no_reponse ...
            
        
       
    
            1
            vote
        
        
            0
            answers
        
        
            571
            views
        
    BLE iOS sending data to Android gattServer peripheral:writeValue:forCharacteristic:type not working
                I am trying to use android as a BLE peripheral (gatt server). I was able to get it advertising, and I can have the iOS app reeive notifications when certain characteristics are changed, but I am ...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            358
            views
        
    Android BLE notification limit and the proper way forward. Are multiple BluetoothGatt objects a good way forward?
                I am developing a BLE app that connects to custom hardware. The hardware supports notifications on as many characteristics as needed. However android only allows me to enable notifications on 15 ...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            192
            views
        
    Bluetooth device not listing in android oreo
                BLE devices like ESP 32 is not getting listed while using react-native-ble-manager on android applications with os version > 8 (oreo).
The same code works fine with android OS versions < 8 (oreo)
            
        
       
     
         
         
         
         
         
         
         
         
         
         
        