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

BLE API >= 21 in deep sleep

I have the following Service in Android public class MyService extends Service{ .... @Override public void onCreate() { .... StartHandler(); ....} public void StartHandler(){ handlerScan = new Handler(); …
0x00
  • 129
  • 1
  • 13
2
votes
0 answers

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 representing a certain value which can be Read, Write…
2
votes
1 answer

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, for some reason connectGatt isn't working. It…
2
votes
1 answer

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 and "translate" them into code. I need to show on…
eldivino87
  • 1,425
  • 1
  • 17
  • 30
2
votes
0 answers

How to turn-on BLE using google play service apis

I tried to turn on ble using location service of google plays service apis. First I connected with successfully. mGoogleApiClient = new GoogleApiClient.Builder(this) .addApi(LocationServices.API) .addConnectionCallbacks(this) …
C B
  • 21
  • 2
2
votes
0 answers

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 are the combination : client (peripherall) is…
2
votes
0 answers

Different Service uuids discovered in android

Im am trying to discover the services of my ble device. When I use a LG l3 my code works fine ( I see the uuid I'm looking for). When I try a Samsung s4 I get different service uuids. Why am i getting different uuids ? private final…
2
votes
1 answer

How can I use semaphore to do a correct android ble communication?

I have one doubt with ble communication from my Android app and one peripheral. This peripheral sends data through notify on a certain characteristics "A" and I can write on it on another certain characteristics "B". For do that I do in this way: …
1
vote
1 answer

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(characteristic, true) val descriptor =…
1
vote
0 answers

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 serviceUUID and reading serviceUUIDs from the…
Ray
  • 31
  • 5
1
vote
2 answers

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 triggers CompanionDeviceService and I see logs that device…
1
vote
0 answers

Android Paring-Dialog popups twice after connect to bonded BLE device

I'm trying to connect an Android Tablet to an already bonded BLE device via BluetoothDevice::connectGatt(...), but the BluetoothParingDialog gets called again twice. The BLE device is based on the Nordic nRF5 series. I created a very simplified…
1
vote
2 answers

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 encrypted. I have been able to do the same thing…
1
vote
0 answers

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(this,…
1
vote
1 answer

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 - so I set the connection priority to…