android-bluetooth

connectGatt on Samsung Galaxy S7 creates connection over Bluetooth Classic instead of BLE

不羁岁月 提交于 2021-01-29 02:30:40
问题 I have a dual-mode (BR/EDR + BLE) device running a GATT server. The address is public and same for BLE and BD/EDR. When I call connectGatt on Galaxy S7 with Android 6.0.1 (API level 23) and set the transport parameter as "TRANSPORT_LE" the phone still tries to establish connection over BD/EDR. It looks like the problem is related to the public address of the BLE because if I set it to private the connection is done over BLE, as expected. This problem was observed only on Galaxy S7, on other

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

Delete all paired bluetooth devices on Android

↘锁芯ラ 提交于 2021-01-27 19:06:32
问题 I would like to delete paired bluetooth low energy devices with names that start with "ABC" on an Android phone programatically. I am using Android studio. 回答1: To unpair all devices use this code Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices(); if (pairedDevices.size() > 0) { for (BluetoothDevice device : pairedDevices) { try { if(device.getName().contains("abc")){ Method m = device.getClass() .getMethod("removeBond", (Class[]) null); m.invoke(device, (Object[])

Bluetooth Le Gatt Not Finding Any Devices

可紊 提交于 2021-01-27 10:50:17
问题 ANSWER: Special thanks to Nelson Hoang below for steering me in the right direction and providing valuble resources. Once the code for adding permissions for locations was added (see Edit2 below) I had to manually go into setting and switch location permissions for the app on. Once this was done it was working very well. Question: I am attempting to connect to Bluetooth LE devices using the standard Bluetooth LE Gatt from the android studio. I am forced to update gradle from 2.8 to 2.10 each

java.lang.NoClassDefFoundError on older Android SDK versions

≡放荡痞女 提交于 2021-01-27 03:53:40
问题 I released a version of my app to the Google Play and woke up this morning with a number of unhappy customers. The latest version of the app integrates support for a Bluetooth Low Energy (BTLE) heart rate monitor. The app runs fine on Android 4.3 and 4.4 but crashes on 4.0, 4.1, and 4.2 with the following error. FATAL EXCEPTION: main java.lang.NoClassDefFoundError: com.eiref.boatcoach.MainActivity at com.eiref.boatcoach.WhatToDo.onClick(WhatToDo.java:274) at android.view.View.performClick

java.lang.NoClassDefFoundError on older Android SDK versions

落花浮王杯 提交于 2021-01-27 03:52:37
问题 I released a version of my app to the Google Play and woke up this morning with a number of unhappy customers. The latest version of the app integrates support for a Bluetooth Low Energy (BTLE) heart rate monitor. The app runs fine on Android 4.3 and 4.4 but crashes on 4.0, 4.1, and 4.2 with the following error. FATAL EXCEPTION: main java.lang.NoClassDefFoundError: com.eiref.boatcoach.MainActivity at com.eiref.boatcoach.WhatToDo.onClick(WhatToDo.java:274) at android.view.View.performClick

Detect if “Bluetooth scanning” for location is turned on

折月煮酒 提交于 2020-12-01 10:49:19
问题 Since Android M it is possible to scan for Bluetooth devices in the background even if the global location is turned off if you have enabled the Bluetooth scanning option in location settings (see screenshot). In order to scan for BLE devices, the following conditions must be met: COARSE_LOCATION or FINE_LOCATION permission granted. And one of the following: Global Location selector enabled. Bluetooth scanning option enabled (see screenshot). I can check that the permission is granted and the

Is there a method to implement in flutter a sort of bluetooth broadcast like beacons?

馋奶兔 提交于 2020-06-17 02:04:07
问题 I would like to know how to realize a sort of "bluetooth broadcast" (using Bluetooth Low Energy) for a Flutter application. In particular, i want to achieve those points: I want to send random string and integers "in the air" using bluetooth. I want also to be able to receive those data by other devices The app must be able to send and receive simultaneously Now, i checked some beacon library from pub.dev (like this or this) but it turns out that probably i did not understand if and how those

Is there a method to implement in flutter a sort of bluetooth broadcast like beacons?

非 Y 不嫁゛ 提交于 2020-06-17 02:04:00
问题 I would like to know how to realize a sort of "bluetooth broadcast" (using Bluetooth Low Energy) for a Flutter application. In particular, i want to achieve those points: I want to send random string and integers "in the air" using bluetooth. I want also to be able to receive those data by other devices The app must be able to send and receive simultaneously Now, i checked some beacon library from pub.dev (like this or this) but it turns out that probably i did not understand if and how those

iOS Background BLE advertising not detectable by Android

北城余情 提交于 2020-05-10 18:36:37
问题 When an iOS BLE peripheral enters the background state, the advertising packets are not emitted in the regular manner and they are placed in a special “overflow” area which is only detectable by another iOS device explicitly looking for this device. The bluetooth-peripheral Background Execution Mode That said, you should be aware that advertising while your app is in the background operates differently than when your app is in the foreground. In particular, when your app is advertising while