All Questions

Tagged with
Filter by
Sorted by
Tagged with
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 ...
Ijas Ahamed N's user avatar
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) ...
Alexander Farber's user avatar
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 ...
user268397's user avatar
  • 1,917
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 ...
Jeff Engebretsen's user avatar
4 votes
3 answers
8k views

Open source implementations of BLE stack

Are there any open source implementations of BLE stack other than BlueZ and Bluedroid?
user299012's user avatar
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 ...
libinm's user avatar
  • 81
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() { @...
Ijas Ahamed N's user avatar
4 votes
0 answers
3k views

How to create Bluetooth L2CAP connection between two devices?

Android 10 released support for BLE CoC connection so I wanted to try this out by making two simple android 10 apps, which would connect to each other with l2Cap and exchange "Hello World". I wrote ...
Nikola Maksimovic's user avatar
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 "...
David Carek's user avatar
  • 1,113
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 ...
Chase Roberts's user avatar
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( ...
Varun Narisetty's user avatar
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, ...
spurrkins's user avatar
  • 126
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/...
Dus's user avatar
  • 4,182
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 ...
Dhananjay Suresh's user avatar
3 votes
1 answer
2k views

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". ...
Marcos Vasconcelos's user avatar
3 votes
0 answers
571 views

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 ...
eldivino87's user avatar
  • 1,435
2 votes
1 answer
1k views

How to make Android connect after the Bluetooth Adapter has been disabled & reenabled?

I have written an app that connects to a BLE device. The app works OK on most devices; but some devices (most noticeably Huawei P8 Lite and Nexus 6P) refuse to connect after the Bluetooth adapter has ...
millibit's user avatar
  • 175
2 votes
1 answer
2k views

BluetoothServiceJni: An exception was thrown by callback 'btgattc_notify_cb'

I am using Android ble to develop an application. The app will connect with the external device using ble. The external device has a sensor that records data and as soon as the android device comes in ...
Saurabh's user avatar
  • 434
2 votes
1 answer
791 views

Get the supported Bluetooth Version in Android phones?(5 or 4.x)

Is there a way to know the Android Bluetooth Ver?( 5 or 4.x - 4.1 or 4.2?) Currently as per https://developer.android.com/about/versions/oreo/android-8.0-changes Feature like Advertisement packet ...
Raulp's user avatar
  • 7,968
2 votes
1 answer
6k views

Scanning for BLE devices on Android 8+ in the background

I'm using the following method from BLE scanner API on Android 8+ to scan for BLE Beacons startScan(List<ScanFilter> filters, ScanSettings settings, PendingIntent callbackIntent) The problem ...
Metwalli's user avatar
  • 1,861
2 votes
2 answers
2k views

How to connect with BLE device for first time (Android)

I was going through BluetoothGatt.java and found the method boolean connect(Boolean autoConnect, BluetoothGattCallback callback, Handler handler) The documentation just above this method ...
Saurabh's user avatar
  • 434
2 votes
0 answers
2k views

Android BLE Gatt Connection Issue (Connection Timeout Status:8)

I'm developing an Android app that discovers and connects to a GATT service that is being advertised by my rPi 3B+. The iOS app that I've finished developing works without any issue. However, almost ...
Nehir Gökçe's user avatar
2 votes
0 answers
914 views

Android BluetoothGatt.getServices(xyz) in onServicesDiscovered returns null for Service xyz listed in onScanResult ScanRecord.getServiceUuids()

I've been doing BLE on Android since 2013/API18/4.3. I know what I am doing, but I can't figure out this simple problem. I am successfully scanning BLE devices and in ScanCallback.onScanResult(...) I ...
swooby's user avatar
  • 3,105
2 votes
1 answer
1k views

Android BluetoothDevice connectGatt not working on HTC M8 with Android 6.0

I have a BLE app that has hundreds of happy users on a variety of devices. Most of my testing has been done on Nexus devices, but a user reported an issue with HTC M8 so I just bought one. Sure enough,...
James Nick Sears's user avatar
1 vote
1 answer
1k views

Trouble Connecting Android App to Raspberry Pi 3 over BLE

I am using the Raspberry Pi 3 model B as a bluetooth peripheral. The Pi is running a GATT server and advertising it as well. I can connect to it from the LightBlue iOS app and can read and write ...
Subir Padhee's user avatar
1 vote
1 answer
1k views

Android - What API can I use to see if a device supports BLE central mode?

https://developer.android.com/guide/topics/connectivity/bluetooth-le#roles Central vs. peripheral. This applies to the BLE connection itself. The device in the central role scans, looking for ...
c_idle's user avatar
  • 1,208
1 vote
2 answers
1k views

Can I have an encrypted BLE connection without bonding? / Pairing BLE devices without bonding

So far I am able to do things two different ways. I can advertise a service on the Pi, connect from an Android app, and read/write characteristics. From my understanding, this communication is not ...
santiago's user avatar
  • 133
1 vote
1 answer
3k views

Android BLE: Is it possible to add Service Data and Manufacturer Data at the same time when advertising an iBeacon packet?

I'm currently doing an experiment in order to trigger a beacon detection device. Here is the sample of a detected beacon that can be used to trigger that device. In my experiment, I'm trying to ...
user1749623's user avatar
1 vote
1 answer
1k views

Android BLE Peripheral Mode: custom characteristics not detected

I am trying to implement a BluetoothGattServer on a Sony SmartWatch 3. I can sucessfully open a Gatt server as well as advertise. Using the BLE Scanner application, I have inconsistent results while ...
Mackovich's user avatar
  • 3,433
1 vote
2 answers
4k views

BluetoothDevice always returns null on getName()

I'm facing this issue consistently in Android 4.4, 5 and 6. I'm performing a BLE Bluetooth devices scan and after it I can access their address (getAddress()), and other data. But if I call device....
agustinaliagac's user avatar
1 vote
0 answers
89 views

Is there any solutions available to send data from BluetoothGattServer to connected devices simultaneously?

Here is my server code: private BluetoothGattServer mGattServer; mBluetoothLeAdvertiser = mBluetoothAdapter.getBluetoothLeAdvertiser(); GattServerCallback gattServerCallback = new GattServerCallback(...
Muneer's user avatar
  • 11
1 vote
1 answer
178 views

ScanCall back not Coming in Android Oreo

I am not able to get my ble scanner working.There is no scanCalll Back is occuring. Below is my code: MainActivity: public class MainActivity extends AppCompatActivity { @Override ...
Raulp's user avatar
  • 7,968
1 vote
0 answers
684 views

onCharacteristicChanged getting called multiple times without change in Characteristic values

I'm developing an android bluetooth low energy app where I'm getting data from a peripheral device in a single characteristic. I have enabled notifications on this characteristic and process ...
Abhinav Tripathi's user avatar
1 vote
0 answers
59 views

gatt.disconnect() is initiated host but not by the app

I've been breaking my head with this issue.... i send a gatt.write command to my remote device, sometimes getting response and sometimes not because the gatt disconnects at all times from my app! (...
user3698465's user avatar
1 vote
0 answers
187 views

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 ...
Shashank Hebbale's user avatar
1 vote
1 answer
1k views

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....
Alexander Farber's user avatar
0 votes
1 answer
700 views

BLE packet drops when Bluetooth and BLE are simultaneously in use

I am using BLE v4.1 for my application where I am able to transfer 200 packets of length 20 bytes each from peripheral to central side. I want to transfer data via BLE and play some music while the ...
Android_dev's user avatar
0 votes
1 answer
573 views

Handling Notifications on Android with Multiple BLE Peripheral Connections

So, I am new to Android development and I am trying to connect my device to multiple BLE devices (T-Wristband) to receive frequent notifications (IMU sensor data less than 20 bytes at 50Hz). When ...
Ehsan Partovi's user avatar
0 votes
1 answer
373 views

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 ...
B L Λ C K's user avatar
0 votes
1 answer
910 views

Android BLE callback OnWriteCallback stops after few seconds

I am trying to write next packet synchronously based on the OnCharacteristicWrite call back condition to achieve a maximum throughput. But for some reason it stops triggering OnCharacteristicWrite ...
Nikhil Shinde's user avatar
0 votes
1 answer
597 views

How to check if a bluetooth response is received within a particular time limit?

I'm developing an app bluetooth to communicate with a device. I have to send to that device a certain packet and that device respond to me in notify mode after a certain time. All works well, but I ...
aeroxr1's user avatar
  • 1,064
0 votes
0 answers
31 views

Uncaught exception thrown by finalizer for Bluetooth Reconnection in Android - java.io.IOException: socket not created

Thanks in advance for helping. I am trying to work with a Serial Bluetooth connection where I am connecting and communicating to the IOT device serially over Bluetooth. So the device has On/Off switch ...
Rakshit Sorathiya's user avatar
0 votes
1 answer
241 views

How to scan BLE devices that use Extended Advertisement and Coded PHY with Android?

I try do create an Android app that scan Bluetooth Low Energy devices that advertise using Extended Advertisement and use Coded PHY for advertisement. I have a nrf52840 peripheral that I have setup to ...
Jonas's user avatar
  • 125k
0 votes
1 answer
298 views

onPhyUpdate is triggered with status 6 = GATT_REQUEST_NOT_SUPPORTED

I'm developing an Android app which communicates via BLE with an external module, and I am trying to set the BLE connection PHY. I've tried calling the method gatt.setPreferredPhy(txPhy, rxPhy, ...
rksilvergreen's user avatar
0 votes
0 answers
224 views

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 @...
Drix Lopez's user avatar
0 votes
0 answers
543 views

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 ...
Martin Dusek's user avatar
  • 1,242
0 votes
1 answer
200 views

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 ...
David Ma's user avatar
0 votes
1 answer
2k views

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 ...
WinterChilly's user avatar
  • 1,579
0 votes
0 answers
175 views

Android BLE Design Pattern viability

I have looked on numerous topics on android BLE stack in various website. From what i gathered, the bluetooth stack in android is unreliable and not suitable for any fast and concurrent connection. ...
ericlee's user avatar
  • 2,733
0 votes
1 answer
1k views

Android O : Ble Scanner not scanning - Not getting any scan call back event

I am using google pixel with Android O . I am seeing that in my application after a while there is no scan call back coming . Below is the btif log I have captured 11-02 19:18:20.561 19922-19985/? E/...
Raulp's user avatar
  • 7,968