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

bluetooth disconnect D/BluetoothGatt: cancelOpen()

When I call to a specific command the ble device seems to be disconnected. I issue two commands and the device seems to be working fine.it process the request and returns a response. but when I call the third command the device automatically…
0
votes
1 answer

Is the transmission power on Bluetooth Low Energy an Android configurable?

I have a Bluetooth Low Energy Android app project here which works fine so far for most of my android smartphones. I use my BLE weather thermometer in my app anywhere within my room, it works. Except for a Huawei P30 Lite deivce: With my Huawei I…
0
votes
1 answer

Write BLE gatt characteristic on Android — error status 255

Experimenting with sample kotlin program, trying to read/write BLE device with channels from 0-7 When reading it gives me value like this: (0x06) onCharacteristicRead(), status=0, value=[uuid='ba7e7814-5b67-43d3-bd80-e72cc83ae801',…
0
votes
1 answer

Get BLE devices in Kotlin

I've got my SettingsActivity allowing the user to choose form a list of paired Bluetooth devices. However, there seems to be something strange going on with Bluetooth Low Energy where devices don't pair normally: the device I'm trying to connect to…
Richard Barraclough
  • 2,625
  • 3
  • 36
  • 54
0
votes
1 answer

Ble distance calculation using Time

Is it possible to calculate distance between BLE-BLE or Beacon-BLE device using Time(T) taken on packet received on receiver device with measured power or RSSI value? Is there any formula for that?
0
votes
1 answer

Android BLE - Measure traffic from inside application

In an android application I want to display the data rate (e.g.: in bytes/second) at which the application (or at least the device) is currently sending data via BLE. For network traffic there is the android networkStatsManager. Is there any tool…
0
votes
0 answers

Background Service Android Using RxAndroidBle

When I connect, write, and notify using backgorund service, connection running well but when I closed the application connection between service and BLE device lost. Can I still connect to device using background service in Android?
0
votes
0 answers

Can't read the value that comes with the GATT Service characteristic; Not sure if I setup the GATT server correctly

The BLE is advertising just fine. I can establish a connection with it but I can't read the characteristic value I set here on the initialization of GATT server. This is the GATT Server setup @ReactMethod public void startServer(Callback…
0
votes
0 answers

How would I get the nrFToolbox for BLE app to use Arduino code written using the ArduinoBLE library?

For reference, I am using the Arduino Nano 33 BLE Sense board. At the moment, I can get the nrFToolbox app to recognize the board as a Bluetooth device, but that's about it. I would like to able to use the app to get data about the temperature and…
0
votes
0 answers

Android periodic ble scan

I have a BLE thermometer that advertises current temperature exactly every 5 seconds. I want to write an app (service) for my Android 9 phone (Xiaomi), that will perform periodic BLE scan to read the temperature at least every 2 minutes even when…
0
votes
0 answers

can start and stop BLE scan for every one second once?

In my app, I have to stop and start the BLE scan for every seconds. In this case scan result are not updating properly and also getting scan failed error like a BLE scan with the same settings is already started by the app Is this every seconds…
thiru
  • 45
  • 1
  • 6
0
votes
1 answer

How can I write to a BLE GATT characteristic using RxAndroidBle in Kotlin?

I am unable to use the sample code to write to a GATT characteristic over BLE. I'm using the following code from Polidea's examples available here: https://github.com/Polidea/RxAndroidBle Code: rxBleDevice.establishConnection(false) …
Martin Erlic
  • 5,467
  • 22
  • 81
  • 153
0
votes
1 answer

Obtaining RSSI from Scan Request / Scan Reply packets

I'm new to android development and I'm writing a APP as proof of concept for a research project using the BLE Google API. I have two android phones, one of which is advertising some beacon X that carries a scan response Y, while the second phone is…
0
votes
1 answer

Is it possible to determine/identify when BLE device is about to disconnect

I have a BLE device (self made) that I pair with my app (iOS+Android). I want to notify the user when the bluetooth signal is weak or better - when the device is about to disconnect. Searching the web resulted with RSSI being the only value that is…
gioravered
  • 1,758
  • 3
  • 19
  • 30
0
votes
1 answer

Android ble: Unable to send large data

I'm trying to implement an app for transfer some strings between ble devices (for now one device act as central and the other one as pheripheral) but without success. This is how my peripheral (server) is set up. Characteristic build fun…