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

How to read and write data into BLE devices in android?

I Scanned the BLE device and its displaying device name, RSSI value and MAC address. How to check whether BLE device has data or no? And how to read and write data from/to BLE Device? Can you please give me an example?
1
vote
0 answers

New Lollipop BLE API does not detect all advertising packets

I have seen a few posts with the same question but I have no been able to get a solution for my problem. I see that the callback function (onScanResult) for the new BLE API detects advertising packets from the peripheral only for the first time. I…
1
vote
1 answer

3 thread running at high frequency uses the same variables

I'm developing an android application that at high frequency receives data from ble notify, print data on the screen and send data to other peripherall. This is my situation : onCharacteristicChanged callback receives a byte array called "value"…
aeroxr1
  • 1,014
  • 1
  • 14
  • 36
1
vote
0 answers

Simple way to read content of BluetoothGattDescriptor in Android BLE

I am trying to get the content of a BluetoothGattDescriptor in Android. I can read the BluetoothGattCharacteristic which returns the Descriptor. When I try and read them this way: byte[] b = descriptor.getValue(); final byte[] data =…
Sbonelo
  • 664
  • 1
  • 9
  • 25
1
vote
1 answer

How to extract latitude and longitude from location_and_speed characteristic?

In an Android app in central role - how do you please get a hold of the latitude and longitude stored in the org.bluetooth.characteristic.location_and_speed characteristic in the org.bluetooth.service.location_and_navigation service of a BLE…
1
vote
1 answer

Android BLE connection disconnects

I am writing an app that scans for ble devices then displays the results in a listview so the user can click on a device to connect. Im having two problems. One is when I stop the Scan and connect to a device the connection is not very good.(The led…
1
vote
1 answer

Android App not reading Values after 0x7F

I have app that receives data from a ble device. first it sends data as |0/1|date1|month1|hour1|minute1|date2|month2|hour2|minute2|0x8A| App reads every values except 0x8A. When i referred some sites it seems that android app reads only standard…
Mr Robot
  • 1,747
  • 6
  • 35
  • 67
1
vote
1 answer

How to extract a bit from a byte and display it on a textview, in Android?

I am receiving a string data from a ble device. I stored it in String names I need to extract a byte from its eighth position, then I need to extract all the bits from the byte. How can I achieve this? Now, I am only able to receive the string . and…
Mr Robot
  • 1,747
  • 6
  • 35
  • 67
1
vote
3 answers

How to Send an Audio HEX file to Ble Device

I have a working ble device with android . it sends and receives data finely through the Android app. But Now My Problem is I want to send Some Audio HEX files to my BLE Device. And its larger Than 20 bytes. How Can i send such a data to a BLE…
Mr Robot
  • 1,747
  • 6
  • 35
  • 67
1
vote
2 answers

Which targetSDK to use for BLE?

I’m building an Android app which should run on every device with Bluetooth Low Energy, which means a minSDK of 18. I’m not sure as to which targetSDK I should use however. I read online that it is good practice to always use the latest version for…
Nimyz
  • 339
  • 2
  • 11
0
votes
0 answers

Android Error (0x3): GATT WRITE NOT PERMIT

After connecting the phone to the ble device on Android, the first time I try to write, I get Error (0x3): GATT WRITE NOT PERMIT error. Occurred while migrating RxBLE library to Nordic Ble library. writeUUID entered correctly. We tested some of the…
SangSun
  • 1
  • 2
0
votes
0 answers

Android BLE: GattCallback.onCharacteristicChanged is not triggered in response of a write operation on Android 12 and below

I am writing an Android app that can connect to a BLE device. There are multiple types of devices handled by my application and I have to know the type of device I am connecting on. The entire connection process is handle by a Service object and…
0
votes
0 answers

Is it possible to know the maximum MTU size supported based on Android version?

I know the way to increase the MTU size of packets exchanged between android device and a bluetooth peripheral is done using BluetoothGatt.requestMtu(int mtu) and BluetoothGattCallback.onMtuChanged(BluetoothGatt gatt, int mtu, int status) But is it…
matdev
  • 4,115
  • 6
  • 35
  • 56
0
votes
0 answers

How to check if a BLE device is currently busy?

I need to check if the device is writing a firmware chunk. If yes, then do not start recording the next chunk. I tried to do it with continuations but it didn't work. Can a reliable write help me in this situation?
0
votes
0 answers

Ionic Native BLE plugin not writing

I have a bluetooth printer, this model: SEWOO LK-P400 I'm trying to develop inside my Ionic application this plugin: Ionic Native - BLE How is the right way to develop that? seeams to have a SDK, how to start? I never develop with a custom SDK, I…