android-bluetooth

Android BLE: “Scan failed, reason app registration failed for UUID”

爱⌒轻易说出口 提交于 2020-01-23 06:35:45
问题 I am developing an application using the RxAndroidBle library that performs BLE scans regularly about every 30 seconds, and some BLE operations every minute or so. After a couple of hours, usually between 5 and 24h, the scan stops working. Every time a scan is supposed to be started, I get: 09-05 09:08:37.160 8160-8160/myapp D/BluetoothAdapter: startLeScan(): null 09-05 09:08:37.165 8160-8160/myapp D/BluetoothAdapter: STATE_ON 09-05 09:08:37.165 8160-8160/myapp D/BluetoothAdapter: STATE_ON 09

Detect if bluetooth headset connected

♀尐吖头ヾ 提交于 2020-01-13 12:13:09
问题 Working on a VOIP application, in silent mode an alert tone or ringtone should play on bluetooth headset only. Able to play it on headphone if connected but if the headset is not connected the tone plays on the speaker though the mobile is in silent mode. Someone please explain if there is a way to detect that a bluetooth headset is connected. 回答1: Here is my code: /** */ class BluetoothStateMonitor(private val appContext: Context): BroadcastReceiver(), MonitorInterface { var

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

How to send same message one by one to a multiple device via bluetooth in android?

随声附和 提交于 2020-01-05 08:30:26
问题 I have list of bluetooth device i just want to send a same message to each device one by one via bluetooth.But at this work i stuck.I am confuse to resolve this problem. Please help..Thanks in advance.. My code snippet is below: public class BluetoothChatService { // Debugging private static final String TAG = "BluetoothChatService"; private static final boolean D = true; // Name for the SDP record when creating server socket private static final String NAME = "BluetoothChat"; // Unique UUID

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

Beacons not detected in Android service

一笑奈何 提交于 2020-01-03 04:25:13
问题 I'm using the Altbeacon library (stable release 2.1.4) to detect beacons. If I do it in an Activity, I have no problems detecting them. However I can't get this to work from a service. Here's what I've got: package com.ibeacontest.android; import java.util.Collection; import org.altbeacon.beacon.Beacon; import org.altbeacon.beacon.BeaconConsumer; import org.altbeacon.beacon.BeaconManager; import org.altbeacon.beacon.BeaconParser; import org.altbeacon.beacon.Identifier; import org.altbeacon

BLE: Read Long Characteristics Value using Android / iOS

人盡茶涼 提交于 2020-01-02 19:21:16
问题 With a normal Characteristics Read only the MTU Size (20bytes) of data will be read. My customer will offer a characteristics with a larger size (about 100bytes). I saw that BLE offers a "Long Read" feature which reads until the size of the characteristics is reached. (https://bluegiga.zendesk.com/entries/25053373--REFERENCE-BLE-master-slave-GATT-client-server-and-data-RX-TX-basics) attclient_read_long command - Starts a procedure where the client first sends normal read request to the server

Android BLE // Using custom service UUID

不问归期 提交于 2020-01-02 07:09:21
问题 We are developping a custom bluetooth low energy peripheral and we need to define our custom service. Based on this link: https://www.bluetooth.org/en-us/specification/assigned-numbers/service-discovery All short UUID (16 bits) are reserved pending future revisions of the BT services specs. And it seems that current version of Android (4.4) doesn't support the 128 bits UUID. So basically i can't use a 16 bits UUID for defining my service, but i can't filter my services with Android for a 128