android-bluetooth

Android Bluetooth: fetchUuidsWithSdp() does not return all UUIDs on some devices

僤鯓⒐⒋嵵緔 提交于 2019-12-06 06:11:29
I have two different bluetooth apps. The first provides a service and listens to commands from the other commander app. I have a GT-I9100T phone and a GT-P5210 tablet. The tablet when acting at the listener works fine and the phone can see the UUID for my app. But when I run the phone as the listener, the UUID of the listener is not listed. I filter the devices by my application UUID so that I know I am talking only to those devices with my application running. My listening app looks like this (I get the same result if I use an insecure connection as well): private final UUID GUID = UUID

Android Lollipop BLE scan - getting peripherals without duplications

て烟熏妆下的殇ゞ 提交于 2019-12-06 04:29:15
问题 Android Lollipop introduced a new way to scan for BLE peripherals, via BluetoothLeScanner. From what I read, the new scanning API solved an issue that happened with the old scanning API (BluetoothAdapter.startLeScan(UUID[],LeScanCallback)) where on some devices the callback ( onLeScan ) was called only once per peripheral, even if the peripheral keeps advertising. This issue is handled on iOS with the CBCentralManagerScanOptionAllowDuplicatesKey option, that allows you to choose whether you

How to check if bluetooth connection to a device is disconnected?

╄→尐↘猪︶ㄣ 提交于 2019-12-06 04:04:18
问题 I want to know when my bluetooth connection to the device gets disconnected. I found this to check: IntentFilter filter1 = new IntentFilter(BluetoothDevice.ACTION_ACL_CONNECTED); IntentFilter filter2 = new IntentFilter(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED); IntentFilter filter3 = new IntentFilter(BluetoothDevice.ACTION_ACL_DISCONNECTED); this.registerReceiver(mReceiver, filter1); this.registerReceiver(mReceiver, filter2); this.registerReceiver(mReceiver, filter3); //The

How to receive intents for Bluetooth devices working?

眉间皱痕 提交于 2019-12-06 02:48:17
I'm trying to have my app's service listen for Bluetooth connection and disconnection attempts, so I can dynamically check/support Bluetooth tethering network communication. First I have two Samsung S4s (running CyanogenMod 10.2, which is Android 4.3.1 based) which I can pair just fine. If I set one device to Bluetooth tether, when the other connects, a new bt-pan network interface is created and DHCP is used to assign IPs. I confirmed this using iwconfig and ifconfig in shell. I have the following perms in my app: (there's more, I'm just pointing out the BT perms I added) <uses-permission

BLE peripheral support Android-L example [closed]

我怕爱的太早我们不能终老 提交于 2019-12-06 01:59:40
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I would appreciate an example of BLE peripheral mode for Android-L. The code that I have gives me strange errors (i.e too many advertisers) which makes no sense as there are no advertisers that i can see from scanner like Lightblue on ios. https://github.com/geoaxis/BluetoothTest works on my nexus 5 running L. At first when initializing advertising I was getting: public static final int ADVERTISE_FAILED

Android Ble GATT_ERROR 133 getting often with samsung devices

元气小坏坏 提交于 2019-12-05 23:01:29
I am working on BLE Applications, I have tested with different devices like Nexus, Moto, Samsung, LG. I am getting the GATT Error 133 in Samsung Devices alone(Samsung A5 2016). Trying to connect 10 times it gets connected only 2 or 3 times.Please Help me out. 来源: https://stackoverflow.com/questions/40465373/android-ble-gatt-error-133-getting-often-with-samsung-devices

Getting the renamed name of an Android BluetoothDevice

时光毁灭记忆、已成空白 提交于 2019-12-05 22:52:47
问题 My android phone allows me rename devices that I have paired with, by going to the [Settings > Wireless & Networkds > Bluetooth] Activity page and clicking the settings button to the right of a paired bluetooth device. However, when I query for a list of Bonded devices with the BluetoothAdapter.getBondedDevices() function, the name that shows up in the results is the default name for the device. How can I access the renamed name for a Bluetooth device? 回答1: You should use alias name . For

how to wait till bluetooth turn on in android

落花浮王杯 提交于 2019-12-05 20:47:58
I need to turn on Bluetooth in an android device programmatically and wait till it on to proceed to next line of code. My code is as below if (!mBluetoothAdapter.isEnabled()) { Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); ctx.startActivity(enableBtIntent); } When doing like this, the code continue to execute from nect line without waiting for bluetooth completely on. Is there any way to solve this? Can I add a look to check if bluetooth is on? You can register a BroadcastReceiver to listen for state changes on the BluetoothAdapter. First create a

Android BLE // Using custom service UUID

不想你离开。 提交于 2019-12-05 20:12:38
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 bits UUID. Anyone got an idea on the best way to implement it ? Thanks M to the K I'm still not sure if

Android stops finding BLE devices: onClientRegistered() - status=133 clientIf=0

旧街凉风 提交于 2019-12-05 15:52:52
问题 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 scan works OK. I am scanning using: mBluetoothAdapter.startLeScan(mLeScanCallback); // for Kitkat and below and mBluetoothAdapter.getBluetoothLeScanner().startScan(mScanCallback); // for Lollipop and above In the Logcat I am getting following messages (I guess this is important for this issue): D