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.

Here is a summary of key BLE terms and concepts:

Generic Attribute Profile (GATT)—The GATT profile is a general specification for sending and receiving short pieces of data known as "attributes" over a BLE link. All current Low Energy application profiles are based on GATT.

The Bluetooth SIG defines many profiles for Low Energy devices. A profile is a specification for how a device works in a particular application. Note that a device can implement more than one profile. For example, a device could contain a heart rate monitor and a battery level detector.

Attribute Protocol (ATT)—GATT is built on top of the Attribute Protocol (ATT). This is also referred to as GATT/ATT. ATT is optimized to run on BLE devices. To this end, it uses as few bytes as possible. Each attribute is uniquely identified by a Universally Unique Identifier (UUID), which is a standardized 128-bit format for a string ID used to uniquely identify information. The attributes transported by ATT are formatted as characteristics and services.

Characteristic—A characteristic contains a single value and 0-n descriptors that describe the characteristic's value. A characteristic can be thought of as a type, analogous to a class.

Descriptor—Descriptors are defined attributes that describe a characteristic value. For example, a descriptor might specify a human-readable description, an acceptable range for a characteristic's value, or a unit of measure that is specific to a characteristic's value.

Service—A service is a collection of characteristics. For example, you could have a service called "Heart Rate Monitor" that includes characteristics such as "heart rate measurement." You can find a list of existing GATT-based profiles and services on bluetooth.org.

Link

Official documentation

video

sample code

281 questions
4
votes
1 answer

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() { @Override public void onReceive(Context context,…
4
votes
3 answers

Open source implementations of BLE stack

Are there any open source implementations of BLE stack other than BlueZ and Bluedroid?
user299012
  • 41
  • 2
  • 6
4
votes
1 answer

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 is not…
4ntoine
  • 19,816
  • 21
  • 96
  • 220
4
votes
2 answers

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= getmBluetoothGatt().readCharacteristic(characteristic); in…
4
votes
1 answer

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 ReadWriteCharacteristic(Context context, String macAddress,…
3
votes
0 answers

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 is because mobile phones always do active scans…
3
votes
2 answers

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, ensuring app stays alive But that's not what I'm…
Maragues
  • 37,861
  • 14
  • 95
  • 96
3
votes
1 answer

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 the dialog I am talking about. how long does the…
Remon Shehatta
  • 1,324
  • 1
  • 10
  • 21
3
votes
1 answer

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 BLE device, even though some devices are…
3
votes
0 answers

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 have to update one after another, By using nordic…
3
votes
1 answer

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 data = AdvertiseData.Builder().apply { …
giozh
  • 9,868
  • 30
  • 102
  • 183
3
votes
0 answers

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 & Bluetooth ON(possibile) 2. Wifi ON, connected &…
c-an
  • 3,543
  • 5
  • 35
  • 82
3
votes
0 answers

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 What does this warning mean ? Can I prevent this…
matdev
  • 4,115
  • 6
  • 35
  • 56
3
votes
1 answer

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'. This is working fine for certain devices like…
3
votes
1 answer

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 8.1.0) I don't get that callback. Is there some…
1 2
3
18 19