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

Android BLE app Gatt call back stops responding

I am trying to develop a BLE app that has multiple activities to control a custom BLE device. The problem I am having right now is dealing when the device is out of range or when connection is lost. The app has a BLE service that handles scanning…
0
votes
1 answer

How to handle BluetoothGattCallback overwrite method onCharacteristicChanged() notification

I am trying to connect my android application with BLE. When an App connects with BLE, i want to read the characteristic data. But in my case, all the characteristic response come in onCharacteristicChanged() method. How I can handle multiple…
dev
  • 11
  • 3
0
votes
1 answer

Android BLE devices not detecting each other

I am trying to use Google's Sample BLE library to send data between two LG Phoenix 4 phones, both running Android 7.1 and both BLE-compatible. I have successfully gotten the app onto both phones, but the phones cannot detect each other. I have…
0
votes
1 answer

Android BluetoothLe keeping Gatt client-server connection alive

I am developing an android BLE application and I have successfully created the app which connects with the BLE peripheral. Right now Gatt server gets disconnected and reconnected again on interval of 30sec, I assume. What I need is now to keep the…
B L Λ C K
  • 600
  • 1
  • 8
  • 24
0
votes
1 answer

BLE - Bluetooth GATT service can't close connection

I have implemented BLE and it works. The flow is: DrawerActivity starts, it sets a fragmentA, which has BLE implementation, because I want active BLE only in fragmentA. So if you switch to fragmentB it should terminate the BLE connection and upair…
WinterChilly
  • 1,549
  • 3
  • 21
  • 34
0
votes
0 answers

GATT_READ_NOT_PERMIT error when trying to use Android device as GATT server

I have an android application that has BLE GATT Server running so the android phone would be a peripheral device and other devices can connect to it. Sometimes the connections works fine, but very often when I try to pair the external device to the…
0
votes
1 answer

readCharacteristic returned true, but onCharacteristicRead is not called

After connecting to BLE device and discovering its services, I check that a certain characteristic is readable, then, I call readCharacteristic. This call returns true, but the callback onCharacteristicRead is not called. After merely 30 seconds,…
MMasmoudi
  • 508
  • 1
  • 5
  • 19
0
votes
1 answer

How to change the bluetooth low energy range in Android as programming?

Is it possible categorize the BLE into four proximity zones: immediate (strong signal; usually up to a few centimeters) near (medium sign; usually up to a few meters) far (weak signal; more than a few meters) unknown ("hard to say", usually when…
0
votes
1 answer

BLE, Scanning devices with service A or B or C

I'm executing a scan with BluetoothLeScanner to search for devices running one of 3 services. I've tried adding the services UUIDs to a ScanFilter list, but it seems the scan searches for devices running the 3 services. List filters =…
Thought
  • 5,326
  • 7
  • 33
  • 69
0
votes
0 answers

After connect and fast disconnect, my BLE module becomes invisible to other devices, even when I stop the app

I have a Bluetooth LE module I connect to with an App (Xamarin based, but not sure that's important). I have noticed that I have some case where I connect to the module, then quickly (attempt to) disconnect, and the module "disappears". It does…
bobwki
  • 794
  • 6
  • 22
0
votes
1 answer

BLE BluetoothGattCallback gets a STATE_DISCONNECTED when device is still ON

Bluetooth device is: Blue Maestro Tempo disk sensor. (Sensor 23, temperature + humidity + dew point sensor) This is the link for the vendor SDK which has the bug I am trying to fix. I connect to the bluetooth device using this method: /** *…
Mena
  • 3,019
  • 1
  • 25
  • 54
0
votes
2 answers

Android BLE scanning with PendingIntent

A few days ago, I was able to successfully get Android to scan for BLE devices using PendingIntents. I'm having trouble today getting the PendingIntent to receive any callback data, and I'm pulling my hair out trying to figure out why. I'm using the…
wheresmycookie
  • 683
  • 3
  • 16
  • 39
0
votes
0 answers

Write to device characteristic in order to "authenticate", Kotlin

I'm very new to RxAndroidBle and RxJava or RxKotlin. I have a task somehow similar to this one, How to receive all notifications in RxAndroidBle I need to wirte to a characteristic in order to "authenticate" and be able to start receiveing…
UncleShell
  • 21
  • 5
0
votes
0 answers

How to send Hex string as a unsigned byte[] to BLE characteristic?

byte bytes[] = {0x04,0x08,0x0F,0x66,(byte)0x99,0x41,0x52,0x43,0x55,(byte)0xAA}; ch.setValue(bytes); If I log the output of this array I get (note the negative values): [4, 8, 15, 102, -103, 65, 82, 67, 85, -86] But in theory this should only be…
Rkreddy
  • 41
  • 3
0
votes
0 answers

Android BLE data reception issue

Im writing a BLE app for android as the title says, but when I select a device from my list of discovered devices (my embedded device), the app connects but no data shows up... unless I select it a second time. I know its connecting the first time…