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

Sending Large File via BLE API on android

I have created BLE sender class for the sending large ByteArray via Bluetooth LE The logic of the send process following: Write descriptor to enable notification on characteristics that sends data Notify peripheral about data sending process…
3
votes
2 answers

The device GattServer stops advertising after connecting to it

This is the link to the GATT Server sample for Android Things on GitHub: https://github.com/androidthings/sample-bluetooth-le-gattserver Setting up the server on RPi-3 is easy enough. What I do not understand is why the GATT server stops advertising…
Ove Stoerholt
  • 3,843
  • 4
  • 25
  • 33
3
votes
1 answer

BLE background scanning

I'm running background service that scan for BLE devices 24/7 using Android BLE API.My service run using START_STICKY. When i find a specific device i do my work. My question is : Do i still get ScanCallback when my device go to deep sleep or do i…
Salah Hammouda
  • 303
  • 2
  • 19
3
votes
1 answer

WiFi connection issues when BLE scan always on

I'm currently scanning BLE devices continuosly and undefenetily, but I noticed that my Samsung J1 loose wifi connections, and any atempt to reconect gives "Authentication Error":"Password incorrect". Stoping BLE scan gives access to the wifi…
3
votes
1 answer

onCharacteristicWrite() is being called, but it doesn't always write

I have a custom piece of hardware with a bluetooth low energy chip. I have set it up with an array with 500 u32s such that array[n] == n. I'm working on an android app that can connect to the device, request the length of the array, and then request…
3
votes
2 answers

How do I effectively read temperature from two BLE devices at the same time?

First of all, I am using RxAndroidBLE library to manage my BLE connections. I have two SensorTag devices and I want to read temperature from both at the same time. For example, I'd like to read the temperature from both devices exactly every 500ms…
Guy
  • 6,414
  • 19
  • 66
  • 136
3
votes
3 answers

How to correctly use UUID.fromString method?

I am trying to read/write these ble characteristics: Right now, I'm trying to read AA01* I am using this library to do it. Here's my code: private void connectToSensorTag(RxBleDevice rxBleDevice) { …
Guy
  • 6,414
  • 19
  • 66
  • 136
3
votes
0 answers

Android BLE receive STATE_DISCONNECTED while the device is still connected

I am developing Android app that connects with BLE device using native BLE API. Many times I receive STATE_DISCONNECTED in the BluetoothGattCallback while the bluetooth device is still connected and can read data from it. This problem happens…
Amani Elsaed
  • 1,558
  • 2
  • 21
  • 36
3
votes
0 answers

BLE - How to get response after writing command?

I have a BLE device with a "particular protocol". I need to send a command to retrieve heart rate measurements (using notifications). My question is: how can I get response after write the "send command"? MY STEPS: 1) Check if the BLE is supported…
3
votes
1 answer

Android BLE Error 0x06 Request Not Supported

My app is facing issue while connecting to BLE device. On every connection attempt app makes, it gets Error code 0x0006(Request not supported) in OnConnectionStateChange() method. I have tried Bluetooth OFF/ON but still getting same error. I am…
Alina
  • 130
  • 1
  • 13
3
votes
1 answer

Android 4.4 BLE Scanning lack of stability

Would a Bluetooth LE Jedi know any trick how to get a reliable BLE scanning mode on cheap Android 4.4 devices ? Everything works fine from Android 5 to 6, and most of the Android 4.4 phones... However, on some cheap phones with 4.4 we encounter…
JBA
  • 2,889
  • 1
  • 21
  • 38
3
votes
2 answers

android ble advertising interval change

since Android 5.0 start to support the peripheral device which allow apps to broadcast advertisements. In my app case, I need broadcast every 20ms to 30ms,but I can't find anyway to change the advertising interval. And the default advertising…
david li
  • 39
  • 1
  • 2
3
votes
2 answers

How can I send data to ble device from second or third activity of the same program

I can send data from the first activity but on repeating the same procedure on the second activity to send data to ble device is not successful. How can I send data from second activity?
sitara
  • 61
  • 11
3
votes
3 answers

Android: adding ScanCallback gives me "Unfortunately, App has stopped." can't find MainActivity

I am very new to android dev. I've watched a few youtube video's and read some documentation. Today is like day 5, so be patient with me. I am trying to build a BluetoothLE app. I stole some code from here, but when I try to run in on my device. I…
Chase Roberts
  • 9,082
  • 13
  • 73
  • 131
3
votes
1 answer

How to detect whenever my android device gets connected/disconnected from paired bluetooth device

I would like to receive an event for detecting whenever bluetooth gets paired or unpaired in my device. In the beginning i found http://developer.android.com/reference/android/bluetooth/BluetoothServerSocket.html. I followed this blog :…
Dus
  • 4,052
  • 5
  • 30
  • 49