All Questions
Tagged with android-ble android
234
questions
55
votes
1
answer
1k
views
Game Command format between bluetooth controller and console
I am creating an Android project, in which I have to make an android wearable smartwatch as a game controller that can send commands to games running on a handheld device connected to that smartwatch ...
15
votes
3
answers
3k
views
BluetoothGattServer cancelConnection does not cancel the connection
I have Android application which exposes BLE Server. I connect with BluetoothGattServer#connect. It works - my app gets call to BluetoothGattServerCallback#onConnectionStateChange with STATE_CONNECTED....
14
votes
1
answer
3k
views
Android Companion device pairing: how to use REQUEST_COMPANION_RUN_IN_BACKGROUND permission?
I'm currently testing Android companion device pairing and I'm not sure how to benefit from the REQUEST_COMPANION_RUN_IN_BACKGROUND permission.
In one part of Google documentation is says:
After the ...
13
votes
4
answers
24k
views
Android BLE Gatt connection change statuses
I have an android app to connect to a BLE device and write to it. I can successfully connect, read and write to it. As a part of testing, we are trying different disconnection scenarios.
Sometimes, if ...
12
votes
2
answers
7k
views
What is the max concurrent Ble connections android M+ can have
My app required to connect 9 Ble devices concurrently.
In this article and any other resource it write that android 4.4+ can connect only to 7 devices.
Is there anything new in M or N versions?
Thanks....
12
votes
2
answers
13k
views
Android stops finding BLE devices: onClientRegistered() - status=133 clientIf=0
I am developing an app in which I can both find and configure BLE devices. I am using standard Android BLE API, but recently I've encountered some strange problems.
When I turn on my app the BLE ...
8
votes
1
answer
3k
views
Restrictions when scanning in background on Android 10?
There seems to be a lot of "hidden features" regarding Bluetooth scanning on Android.
For starters there is a "30s limit" (Android 7.0 ble scan no result). Then you have to set a ScanFilter in ...
8
votes
2
answers
5k
views
Scanning for BLE peripherals with a scan filter based on advertised service UUID
I have a custom BLE peripheral that advertises data like this:
In other words, my BLE peripheral advertises a service UUID associated with a unique identifier in advertised service data, but it does ...
8
votes
0
answers
1k
views
Android BLE device scan with device name filter is not working
I am using device name filter to connect to a specific BLE device. But my scan call back is not executing. It works fine when I use MAC address as filter. Is this a known issue or bug? I am testing on ...
7
votes
4
answers
7k
views
Disconnecting a BluetoothDevice without BluetoothGATT
My app talks to a BLE peripheral. Sometimes the app is started with that peripheral already connected. I can retrieve the device by calling:
BluetoothManager manager = (BluetoothManager) ...
7
votes
2
answers
4k
views
Reacting to BLE directed advertising (ADV_DIRECT_IND) in Android
How to react to directed advertising (ADV_DIRECT_IND == 0001) in Android?
There is a BLE-gadget which sends directed advertising to an Android phone (using hardcoded MAC address of the phone for now) ...
6
votes
1
answer
10k
views
Android BLE readCharacteristic fails
I'm trying to read the initial state of a BLE device when I connect to it. Here's the code I have to try to do that:
@Override
public void onServicesDiscovered(BluetoothGatt gatt, int status)
{
...
6
votes
3
answers
2k
views
I want to identify the BLE wheel and crank sensor data from the 11-bytes data from a mobile application we have developed
I want to identify the wheel and crank sensor data from the 11-bytes data. I have tried to parse the 11-bytes hex data which i got in our mobile application as per the split ups in the link below.
...
6
votes
6
answers
2k
views
Android BLE onScanResult is never called in the background on Android 11. Was working on Android 10
I have an app which scans for BLE devices. It was working perfectly on Android 10, but since I updated my phone to Android 11, the onScanResult just never gets called if I put the application to the ...
6
votes
2
answers
716
views
Nearby Messages using an IntentService
Initially I setup a BroadcastReceiver to receive intents from the Nearby Messages API.
class BeaconMessageReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent)...
5
votes
1
answer
5k
views
Why isMultipleAdvertisementSupported() returns false, when getBluetoothLeAdvertiser returns an object?
I am trying to play with BLE transmission on my device.
Here is the code I use and the output:
// check BLE support
Log.i(TAG, "BLE supported: " + getPackageManager().hasSystemFeature(...
5
votes
1
answer
9k
views
android - stopLeScan() & startLeScan() deprecated in API Level 22 - How do I go about replacing this with stopScan() and startScan()?
I see that stopLeScan() & startLeScan() are deprecated in Android 5.1.1. I am having issues replacing my stopLeScan() & startLeScan() methods. Here is my following code:
@Override
protected ...
5
votes
1
answer
3k
views
How to make a BLE connection that is connected using service to use across the activities without stopping the service or disconnecting ble?
I have 3 components.
Activity1 has button for connecting and disconnecting the BLE Connection
Activity2 Needs to Get the data from the BLE Device.
Service All the connection logic (like ...
5
votes
2
answers
902
views
Android Bluetooth (BLE) corrupted data on onCharacteristicChanged
My app do the following:
It sends a command with onDescriptorWrite to the BT device.
As soon the BT device gets this command it starts transferring data to the Android phone.
Android's ...
5
votes
2
answers
925
views
Android Bluetooth LE SCAN_FAILED_OUT_OF_HARDWARE_RESOURCES
In my Android (API version 21 and above) Bluetooth LE app, the app starts by scanning for the peripheral using a BluetoothLeScanner and a ScanCallback object.
This works fine the first few times the ...
5
votes
2
answers
6k
views
How do I make sure app is disconnecting from a Bluetooth LE device?
I have two devices that I'm connecting to. When I leave the app I'm disconnecting from the devices. Both go through the same process but sometimes one of the devices maintains a connection until I ...
5
votes
0
answers
552
views
Missing BLUETOOTH_CONNECT permission but compile/target SDK are configured to 30
I'm implementing an Android library which supports some BLE utilities. In my build.gradle, both compile and target SDK are configured to 30, but I encountered missing permission error at compile time:
...
5
votes
1
answer
2k
views
Android Ble disconnect time delay
I wrote some code to connect my android phone to a ble device. When I power off the ble device my phone takes a few seconds (2-20s) to notify me that it has lost connection to the ble device. Is ...
5
votes
1
answer
3k
views
bluetoothGatt writeCharacteristic returns false
I created a peripheral with a WRITE_TYPE_NO_RESPONSE characteristic.
With another application, I wrote on characteristic, but I have an occasional problem with samsung galaxy nexus i9250 with lollipop ...
4
votes
2
answers
5k
views
What is ENABLE_INDICATION_VALUE and ENABLE_NOTIFICATION_VALUE in Client Characteristic Configuration Descriptor in ble?
I have been working on an app to read and write data from another BLE device. I don't have any issues going on from the app point of view. Just some of the conceptual doubts I need to clarify. So:
...
4
votes
2
answers
5k
views
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 ...
4
votes
1
answer
4k
views
Bluetooth GATT onConnectionState Change does not work on Lollipop
I currently have a method which writes to the BLE devices to beep it. My Bluetooth Callback goes as follows :
public class ReadWriteCharacteristic extends BluetoothGattCallback {
public ...
4
votes
2
answers
2k
views
how to define SampleGattAttributes in the following code?
public final static UUID UUID_HEART_RATE_MEASUREMENT =
UUID.fromString(SampleGattAttributes.HEART_RATE_MEASUREMENT);
SampleGattAttributes, appears in red colour,means unresolved ...
4
votes
1
answer
801
views
Android - BLE bonding programmatically doesn't work on all CoolPad Note 3
I am using below broadcast receiver to catch bond request and bond it without user popup request.
private static BroadcastReceiver pairingBroadcastReceiver = new BroadcastReceiver() {
@...
4
votes
1
answer
2k
views
How to test BLE objects on Android?
I am learning to communicate over Bluetooth Low Energy on Android.. Here is an example app
There in there source code are several Bluetooth related objects, which were final classes obviously:
private ...
4
votes
1
answer
3k
views
How can I advertise via BLE 100 bytes?
How can I advertise via BLE 100 bytes?
SDK >= 26
I am able to advertise 20 bytes, but when I advertise more than 20 bytes, I get an Exception.
I have already read these articles:
Android: Sending ...
4
votes
1
answer
786
views
Android BLE startDiscovery() callback is not fired even with Location permissions
The app is targeted to 22 with minimum version 18 and works as expected on Lollipop. Starting Marshmallow apps need to require 'fine' and 'coarse' permissions for BLE. I've added them but the callback ...
4
votes
0
answers
196
views
How do I avoid requesting BLE scan response?
I have a mobile app (android & iOS) that scans for peripherals with a filter by service UUID. I noticed a degradation in discoverability when multiple centrals scan at the same time. I assume this ...
4
votes
0
answers
891
views
Why does a text box appear behind the Bluetooth permission dialog for my Android app?
I am writing an app that requires Bluetooth to be enabled to use and there is a strange "title like" set of text that appears behind the alert dialog that asks to enable Bluetooth. The text says "...
3
votes
3
answers
3k
views
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 ...
3
votes
3
answers
25k
views
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) {...
3
votes
1
answer
4k
views
Getting Type_Gatt_Error with status 133 while connecting to AND UA651BLE
I am trying to connect to AnD UA-651BLE blood pressure monitor and get the values in an android app. The app is able to find the device but I am getting Type_Gatt_Error in 'onConnectionStateChange'.
...
3
votes
2
answers
4k
views
Android bluetooth get the heart rate measurement
I want to get the value of the HRM of an "A&D UA-651BLE" device.
this is what's written in the datasheet of this device to get the HRM value:
Set the application to pairing mode to start ...
3
votes
1
answer
2k
views
Android BluetoothGatt not receving Characteristic Notifications BluetoothGatt#writeDescriptor(desc) return false
I am working on an application which needs to communicate with a Bluetooth LE device.
This is the code I use to set the CharacteristicNotification
public boolean setCharacteristicNotification(
...
3
votes
2
answers
1k
views
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 ...
3
votes
1
answer
8k
views
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, ...
3
votes
1
answer
3k
views
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/...
3
votes
1
answer
515
views
increase Android BLE bonding / pairing dialog timeout
I have an android app that connects to a BLE device and pairs with it using BleDevice.createBond(). the issue is that the dialog could disappear before the user noticing it.
here is a screenshot of ...
3
votes
2
answers
576
views
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 ...
3
votes
2
answers
831
views
CompanionDeviceService unbinds immediately
I'm trying to implement CompanionDeviceService in order to interact with our BLE device. According to the documentation
System will keep this service bound whenever an associated device is nearby, ...
3
votes
1
answer
557
views
Android: Why is BluetoothLeScanner sometimes not discovering any BLE device?
I'm using BluetoothLeScanner to scan for BLE devices, which I start using:
startScan(null, settings.getScanSettings(), scanCallback);
Every once in a while, a call to startScan() does not discover any ...
3
votes
0
answers
3k
views
Why can't use Bluetooth and Wifi simultaneously?
This is hardware related question. But also software related.
I am making an Android app using bluetooth. And I tested my devices with wifi and bluetooth.
And the result is:
1. Wifi ON, connected &...
3
votes
0
answers
324
views
What does warning "BluetoothRemoteDevices: Skip name update" mean?
My app scans for Bluetooth devices.
When the app's Bluetooth scanner is scanning, it generates a lot of the following warnings
W/BluetoothRemoteDevices: Skip class update for AB:CD:12:34:56:78
...
3
votes
1
answer
1k
views
Turning off Bluetooth Adapter not calling onConnectionStateChange Android 8.1.0
Turning off the bluetooth in Android system settings gives us the BluetoothGattCallback.onConnectionStateChange() call in Android < 27 (Oreo). However when I try it on my Pixel or Nexus 5X (Android ...
3
votes
1
answer
615
views
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 ...