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
0
votes
1 answer

In Android BLE which callback to use to ensure successful Message Delivery to remote BLE Device?

Which one is the actual confirmation callBack which tells that the data has been successfully delivered to the remote BLE Device from the Android Phone? onCharacteristicWrite() or onCharacteristicChanged() or something else. The data I am writing is…
Raulp
  • 7,758
  • 20
  • 93
  • 155
0
votes
1 answer

Android BLE gattcallback issue on read and write

I'm stuck in one weird problem from last week and it will make me mad soon, Stackoverflow is my last hope. I simply wrote a code to communicate with BLE device. At first i'm just writing a value on characteristic. public void…
Salman Naseem
  • 462
  • 4
  • 17
0
votes
2 answers

debugging Android Bluetooth Disconnection

I am seeing the Android bluetooth disconnection often when I am trying to interact with a hardware using my android app. I am nto sure if it is due to my Android App/firmware or due to some other Android API issue.What logs I can enable to check the…
Raulp
  • 7,758
  • 20
  • 93
  • 155
0
votes
1 answer

Android BLE callback OnWriteCallback stops after few seconds

I am trying to write next packet synchronously based on the OnCharacteristicWrite call back condition to achieve a maximum throughput. But for some reason it stops triggering OnCharacteristicWrite callback at very initial after 1-2 sec of period and…
0
votes
3 answers

Getting onCharacteristicWrite status=0, but BLE device does not send any data

I am sending this command AE A7 04 00 05 09 BC B7 to BLE, onCharacteristicWrite returns status=0, but BLE device does not send any data ( I mean I do not get any response ). So what is wrong ? Maybe I am sending in a wrong format ? public void…
abrutsze
  • 496
  • 1
  • 8
  • 24
0
votes
1 answer

Service v/w Gatt connection in Android BLE API

I am noticing in the adb logs that the services are discovered first and then the (gatt) connection is made with the device . Is it true? Isn't the gatt connection is made first and then the services are discovered from the slave device.
Raulp
  • 7,758
  • 20
  • 93
  • 155
0
votes
1 answer

How to send AE A7 04 00 05 09 BC B7 command to BLE

I need to send AE A7 04 00 05 09 BC B7 command to BLE device. Can You help me to manage it ? I mean what and how have I to do after connection to device ? public void WriteValue(String strValue) { mNotifyCharacteristic.setValue("AE…
abrutsze
  • 496
  • 1
  • 8
  • 24
0
votes
1 answer

Android BLE is NOT connecting again after BLE device timeout [Using RxAndroidBle ]

I am working on Android BLE using RxAndroidBle library. The BLE device has a timeout of 5 min if there is no interaction. i.e. The device will disconnect automatically if there is no read/write operations for 5 minutes. I am getting BleGattException…
0
votes
0 answers

Android retrieve or assign BluetoothGattCallback to-from active connection initiated in 3rd party library

I currently have a project on my desk which uses a 3:rd party library that deals with (BLE) device specific functionality. That means, library handles attempts to connect, enabling characteristics notifications, readings and writings. The problem…
Deko
  • 1,028
  • 2
  • 15
  • 24
0
votes
2 answers

GATT onDescriptorRead - only one callback

I've initiated a BLE connection, in onServicesDiscovered I'm going to read out all descriptors. There are five of them and I proceed with this: for (int n=0;n
0
votes
1 answer

what does mAdvertiseFlags = -1 means in the Android BLE Application?

While runnig a BLE android App I am getting mAdvertiseFlags = -1 in the adblog for a given Mac ID of a wearbale_X , what does -1 means?Sometime mAdvertiseFlags becomes 4. For some other wearbale_Y I get mAdvertiseFlags =6 continously .
Raulp
  • 7,758
  • 20
  • 93
  • 155
0
votes
0 answers

Android BLE Connection, time interval

Hello I am new in Android BLE, I am connecting BLE device, in that if connection fails it will try to reconnect 5 times, if still connection failed, then it will show message to user that connection is FAILED other wise it will try 5 times Below is…
0
votes
1 answer

Android BLE iBeacon advertisement packet larger than expected

I'm attempting to get an estimated range to a BLE device, given the devices RSSI and calibrated transmission power. The calibrated txPower is supposedly emitted as the last byte in the peripherals iBeacon advertisement packet. These packets,…
0
votes
1 answer

BLE WRITE and Read Issue?

Please anyone help me, I already tried many ways. BluetoothGatt mBluetoothGatt mBluetoothGatt.writeCharacteristic(mWriteCharacteristic) return true but readCharacteristic(BluetoothGattCharacteristic characteristic) return false.I could not find…
user2372490
  • 81
  • 1
  • 6
0
votes
1 answer

BLE writeCharacteristic and readCharacteristic issue

I am a beginner of BLE in my case BLE write characteristic true but BLE readCharacteristic failed.I followed this working example but I changed the service UUID and getCharacteristic UUID.But till i receive the read failed.Kindly help anyone i tried…
user2372490
  • 81
  • 1
  • 6