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
3
votes
2 answers

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 scanning. Start pairing of A&D BLE device following each…
user4844052
3
votes
1 answer

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( BluetoothGattCharacteristic characteristic, boolean…
2
votes
1 answer

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 callback function is never invoked. I am unable to…
2
votes
2 answers

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 = BluetoothLeDeviceFilter.Builder() …
2
votes
1 answer

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.how long will it be scanning for? 2.is there a…
2
votes
1 answer

How to get deviceServices from flutter_reactive_ble example

I'm working with the example that is provided in the flutter_reactive_ble project (https://github.com/PhilipsHue/flutter_reactive_ble), specifically on the device_detail_screen.dart file. It works as much as I believe it should work, but I'd like to…
AmericanMade
  • 453
  • 1
  • 9
  • 22
2
votes
0 answers

Delay in Android BLE StartScan returning a match

We have developed an Android app that tracks vehicle journeys, where each vehicle has a BLE device installed that wakes up when the vehicle is started. To identify when the user is in the vehicle and when we should start tracking their journey, the…
2
votes
0 answers

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 every time (95%) my Android app connects to the…
2
votes
0 answers

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. I want any specific error code or method to…
2
votes
0 answers

BLE: Reconnect Android central to iOS peripheral

After days of research and trial and error my colleagues and I have to hope that the StackOverflow community has a working solution. We got an Android Smartwatch. We developed an app which acts as the BLE central. The App shows a QR-Code encoding an…
RafaelKr
  • 915
  • 8
  • 18
2
votes
2 answers

Is BLE scan will work in tablets which does not have GPS chip?

I am working in BLE apps. I have some doubts in GPS permission to perform BLE scanning. Is BLE scan will work in tablets which do not have GPS chip? startLescan() will work without GPS permission?
thiru
  • 45
  • 1
  • 6
2
votes
1 answer

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 length ~ 60 bytes of more than usual (that is 31…
2
votes
1 answer

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 filters, ScanSettings settings, PendingIntent callbackIntent) The problem is that after sometimes I can see Scan Logs but nothing…
Metwalli
  • 1,861
  • 1
  • 18
  • 27
2
votes
1 answer

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 been disabled. This is the test sequence: Make…
2
votes
0 answers

BLE different MTU for different implementations

I have tried different implementations of BLE connection on Android. One with RxAndroidBle and another one with simple Android API. I used RxAndroidBle example app for testing. I connect to the same peripheral with the same service and…