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
Filter by
Sorted by
Tagged with
55 votes
1 answer
1k views

Game Command format between bluetooth controller and console

I am creating an Android project, in which I have to make an android wearable smartwatch as a game controller that can send commands to games running on a handheld device connected to that smartwatch ...
Manish Dubey's user avatar
  • 4,286
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
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 ...
Ijas Ahamed N'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
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 ...
fragon's user avatar
  • 3,421
8 votes
1 answer
3k views

Restrictions when scanning in background on Android 10?

There seems to be a lot of "hidden features" regarding Bluetooth scanning on Android. For starters there is a "30s limit" (Android 7.0 ble scan no result). Then you have to set a ScanFilter in ...
Alix's user avatar
  • 2,737
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
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 ...
Adam Varhegyi's user avatar
6 votes
2 answers
716 views

Nearby Messages using an IntentService

Initially I setup a BroadcastReceiver to receive intents from the Nearby Messages API. class BeaconMessageReceiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent)...
Bryan's user avatar
  • 15k
5 votes
1 answer
5k views

Why isMultipleAdvertisementSupported() returns false, when getBluetoothLeAdvertiser returns an object?

I am trying to play with BLE transmission on my device. Here is the code I use and the output: // check BLE support Log.i(TAG, "BLE supported: " + getPackageManager().hasSystemFeature(...
LA_'s user avatar
  • 20.1k
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
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 ...
Adam Varhegyi's user avatar
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
0 answers
552 views

Missing BLUETOOTH_CONNECT permission but compile/target SDK are configured to 30

I'm implementing an Android library which supports some BLE utilities. In my build.gradle, both compile and target SDK are configured to 30, but I encountered missing permission error at compile time: ...
Jing-Wei Wu'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
4 votes
0 answers
891 views

Why does a text box appear behind the Bluetooth permission dialog for my Android app?

I am writing an app that requires Bluetooth to be enabled to use and there is a strange "title like" set of text that appears behind the alert dialog that asks to enable Bluetooth. The text says "...
David Carek's user avatar
  • 1,113
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= ...
brandy embedded's user avatar
3 votes
3 answers
3k views

Android: adding ScanCallback gives me "Unfortunately, App has stopped." can't find MainActivity

I am very new to android dev. I've watched a few youtube video's and read some documentation. Today is like day 5, so be patient with me. I am trying to build a BluetoothLE app. I stole some code from ...
Chase Roberts'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
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 ...
user avatar
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
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/...
Dus's user avatar
  • 4,182
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
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 ...
Guy's user avatar
  • 6,483
3 votes
2 answers
3k views

android ble advertising interval change

since Android 5.0 start to support the peripheral device which allow apps to broadcast advertisements. In my app case, I need broadcast every 20ms to 30ms,but I can't find anyway to change the ...
david li's user avatar
3 votes
2 answers
831 views

CompanionDeviceService unbinds immediately

I'm trying to implement CompanionDeviceService in order to interact with our BLE device. According to the documentation System will keep this service bound whenever an associated device is nearby, ...
Maragues's user avatar
  • 38.1k

1
2 3 4 5 6