android-ble

Android 4.4 BLE Scanning lack of stability

旧时模样 提交于 2019-12-04 13:02:24
Would a Bluetooth LE Jedi know any trick how to get a reliable BLE scanning mode on cheap Android 4.4 devices ? Everything works fine from Android 5 to 6, and most of the Android 4.4 phones... However, on some cheap phones with 4.4 we encounter random issues, some phones do not detect anything, or sometimes just a few beacons among others, depending on environment, daytime, weather, or whatever... It's obviously due to a poor software or hardware on this side, but is there any trick to make it more stable programmatically ? (for example enabling / disabling Bluetooth regularly) EDIT To

Why isMultipleAdvertisementSupported() returns false, when getBluetoothLeAdvertiser returns an object?

╄→尐↘猪︶ㄣ 提交于 2019-12-04 10:08:08
I am trying to play with BLE transmission on my device. Here is the code I use and the output: // check BLE support Log.i(TAG, "BLE supported: " + getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)); // true // check BLE transmission support final BluetoothManager bluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE); BluetoothAdapter mBluetoothAdapter = bluetoothManager.getAdapter(); Log.i(TAG, "isMultipleAdvertisementSupported: " + mBluetoothAdapter.isMultipleAdvertisementSupported()); // false Log.i(TAG, "isOffloadedFilteringSupported: " +

Android BLE startDiscovery() callback is not fired even with Location permissions

耗尽温柔 提交于 2019-12-04 09:56:27
The app is targeted to 22 with minimum version 18 and works as expected on Lollipop. Starting Marshmallow apps need to require 'fine' and 'coarse' permissions for BLE. I've added them but the callback is not fired. AndroidManifest: ... <uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/> <!-- ble --> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission

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

a 夏天 提交于 2019-12-04 01:37:43
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/BluetoothAdapter: onClientRegistered() - status=0 clientIf=5 In my app I can also read certain

BluetoothDevice always returns null on getName()

浪子不回头ぞ 提交于 2019-12-02 03:49:54
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.getName() it returns null EVERY TIME. This documentation is not helpful, it only says that returns null if "there was a problem" : https://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#getName() Other posts that I visited unsuccessfully : https://code.google.com/p/android/issues/detail?id=34411 android BluetoothDevice.getName() return null ble device bluetoothdevice.getname()

How to Send an Audio HEX file to Ble Device

99封情书 提交于 2019-12-01 13:18:16
I have a working ble device with android . it sends and receives data finely through the Android app. But Now My Problem is I want to send Some Audio HEX files to my BLE Device. And its larger Than 20 bytes. How Can i send such a data to a BLE Device. ?? For send data upper than 20bytes, you need to change the MTU-exchange. To API LEVEL 21, you can use requestMtu ( Android Developer ), it negotiates with the peripherical device and you can define until 512 bytes. The MTU value is defined in peripherical side. Remember the data size that you can send is MTU-3 bytes. For API LEVEL less than 21,

What is the max concurrent Ble connections android M+ can have

喜你入骨 提交于 2019-12-01 06:15:23
My app required to connect 9 Ble devices concurrently. In this article and any other resource it write that android 4.4+ can connect only to 7 devices. Is there anything new in M or N versions? Thanks. The number of connections is limited by the constants MAX_L2CAP_LINKS and GATT_MAX_PHY_CHANNEL which is currently (still) set to 7. If you try to connect the 8th device with autoConnect = true, the stack will hang and fail to connect again until you restart Bluetooth due to a bug introduced in Android M. If you use autoConnect = false to connect an 8th device you will immediately get an

What is the max concurrent Ble connections android M+ can have

这一生的挚爱 提交于 2019-11-28 04:48:52
问题 My app required to connect 9 Ble devices concurrently. In this article and any other resource it write that android 4.4+ can connect only to 7 devices. Is there anything new in M or N versions? Thanks. 回答1: The number of connections is limited by the constants MAX_L2CAP_LINKS and GATT_MAX_PHY_CHANNEL which is currently (still) set to 7. If you try to connect the 8th device with autoConnect = true, the stack will hang and fail to connect again until you restart Bluetooth due to a bug