android-ble

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

陌路散爱 提交于 2021-02-07 21:40:05
问题 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 : http://android-er.blogspot.co.il/2014/12/make-bluetooth-connection-between.html which is quite usefull, but, isn't detecting when a new connection is made. Needless to say, I have no use for bluetooth implementation, which i'm well aware of : final

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

不问归期 提交于 2021-02-07 21:38:26
问题 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 : http://android-er.blogspot.co.il/2014/12/make-bluetooth-connection-between.html which is quite usefull, but, isn't detecting when a new connection is made. Needless to say, I have no use for bluetooth implementation, which i'm well aware of : final

BLE Advertise data size limit

百般思念 提交于 2021-01-29 07:42:54
问题 On My Addroid app I'm trying to add some extra data when I try to start ble advertising, and as I've read, advertise data must be <= 31 bytes. That's how I do it: var testData = "abcdefghij" var data = AdvertiseData.Builder().apply { addServiceData( ParcelUuid(MY_UUID), testData.toByteArray(Charsets.UTF_8) ) } bleAdvertiser.startAdvertising( settings.build(), data.build(), advertiseCallback ) In this way everything works well. Now if testData fields become var testData = "abcdefghijk"

How to disable a notification with rxandroidble?

自古美人都是妖i 提交于 2021-01-28 23:49:53
问题 I'm currently trying to use rxandroidble in order to replace the native BLE API of Android of one of our app. How to disable a notification? I'm able to enable it with the sample code, this one: device.establishConnection(context, false) .flatMap(rxBleConnection -> rxBleConnection.setupNotification(characteristicUuid)) .doOnNext(notificationObservable -> { // OK }) .flatMap(notificationObservable -> notificationObservable) .subscribe(bytes -> { // OK }); But in my product I have a use case

How to extract latitude and longitude from location_and_speed characteristic?

那年仲夏 提交于 2020-02-06 04:26:24
问题 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 peripheral? I am trying the following Java-code - private float mLatitude; private float mLongitude; private static final UUID LOCATION_AND_NAVIGATION = UUID.fromString("00001819-0000-1000-8000-00805f9b34fb"); private static final UUID LOCATION_AND_SPEED

How to correctly use UUID.fromString method?

眉间皱痕 提交于 2020-01-13 19:16:18
问题 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) { rxBleDevice.establishConnection(getApplicationContext(), false) .doOnError(new Action1<Throwable>() { @Override public void call(Throwable throwable) { int i = 0; } }) .flatMap(rxBleConnection -> rxBleConnection.readCharacteristic(UUID.fromString("AA01*"))) .subscribe(new Subscriber<byte[]>() {

Android BLE Gatt connection change statuses

白昼怎懂夜的黑 提交于 2020-01-12 06:15:30
问题 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 scenarions. Sometimes, if ble device disconnect the connection, i get the connection change as disconnect with status value as 19. Also if there is any bond error, status equals 22. If i programmatically disconnect the connection, this status gives me 0. But none of these states except 0 are specified in android

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

喜欢而已 提交于 2020-01-03 20:08:47
问题 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 the datapoints in the array one at a time. The android app appears to be mostly working fine. It connects to the device, requests the length, and continues to request the next piece of data AFTER the previous piece was received. However, partway

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

筅森魡賤 提交于 2020-01-03 20:06:17
问题 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 the datapoints in the array one at a time. The android app appears to be mostly working fine. It connects to the device, requests the length, and continues to request the next piece of data AFTER the previous piece was received. However, partway

Getting Type_Gatt_Error with status 133 while connecting to AND UA651BLE

点点圈 提交于 2020-01-03 19:32:09
问题 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'. This is working fine for certain devices like samsung galaxy S5, Moto G4 etc. but not for certain phones like redmi 3s prime, etc. This works well and i am able to read data, when i unpair the device and re pair it everytime. I am not able to understand anything as i am new to android-ble