-
-
Notifications
You must be signed in to change notification settings - Fork 763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support Android 13 / SDK 33 BLE library updates #943
Comments
Hi, |
The library is working also on Android 13 |
I'm not sure that it is. Android 13, Samsung Galaxy S21 Ultra. No peripherals added during scan Edit: Location permissions issue. Disregard |
It is working, this issue is about supporting new non-deprecated methods for certain inner workings as explained in the issue desc. This is not (yet) a blocking issue. If you have issues with scan, there are probably a whole lot of reasons why, and they are probably not related to this library as scanning conditions may be tricky when first putting your hands into BLE on android. |
Hi, |
Make sure in your manifest you have With the "neverforlocation" tag on the BLUETOOTH_SCAN permission, it will allow BLE scanning without needing location permissions. Do keep in mind even if permissions are granted, the respective adapters must be on for the scan to work. |
Thanks @askkerr. |
I'd love to help, but I'm not really even sure how you are finding classic devices. This library should only be for BLE. |
@MuhammadFaisal215 just a thought, but are you specifying the service UUIDs of the devices you plan to be searching for? In my experience Android 13 on a Samsung S21 Ultra did not care if I specified service UUIDs, but we had issues on iOS if we didn't specify any UUIDs. Maybe it is a similar case with different hardware? |
Same for me... I couldn't find any solution to fix this :( |
Good morning,
|
Bonjour,
Ravi pour vous !
Cordialement
P. Nolin
De : usama-tariq-qbatch ***@***.***>
Envoyé : jeudi 29 février 2024 10:35
À : innoveit/react-native-ble-manager ***@***.***>
Cc : Aladin-83 ***@***.***>; Mention ***@***.***>
Objet : Re: [innoveit/react-native-ble-manager] support Android 13 / SDK 33 BLE library updates (Issue #943)
Good morning, Being stuck on the same problem, after a few hours of testing and research, I found the solution! It is imperative to put
`<uses-permission android:name="android.permission.BLUETOOTH_SCAN"
android:usesPermissionFlags="neverForLocation" >
in the manifest and check the authorizations in the program:
if (Platform.OS === 'android' && Platform.Version >= 23) {
console.log('In verifyBluetoothAuthorization...',
Platform.Version)
PermissionsAndroid.requestMultiple([
PermissionsAndroid.PERMISSIONS.BLUETOOTH_SCAN,
PermissionsAndroid.PERMISSIONS.BLUETOOTH_CONNECT,
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
]).then(result => {
if (
(result['android.permission.BLUETOOTH_SCAN'] &&
result['android.permission.BLUETOOTH_CONNECT'] &&
result['android.permission.ACCESS_FINE_LOCATION'] === 'granted')
||
(result['android.permission.BLUETOOTH_SCAN'] &&
result['android.permission.BLUETOOTH_CONNECT'] &&
result['android.permission.ACCESS_FINE_LOCATION'] === 'never_ask_again')
) {
console.log('User accepted');
ActiveBluetoothInDevice()
} else {
console.log('User refused'); }
});
} ```
and suddenly everything works!
Thanks alot @Aladin-83 <https://github.com/Aladin-83> I was searching for the fix for a long time, and your solution worked magically.
—
Reply to this email directly, view it on GitHub <#943 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AL3UDWUM3EFSGLCMMVM67T3YV322NAVCNFSM6AAAAAAT437EI6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZQG42DQMJWGU> .
You are receiving this because you were mentioned. <https://github.com/notifications/beacon/AL3UDWXFZHK22YCKXN5I7JDYV322NA5CNFSM6AAAAAAT437EI6WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTVO45QK.gif> Message ID: ***@***.***>
|
Hi, as you may be aware, android 13 partially switched it's BLE stack to Gabeldorsche this summer. This change mainly impacts Advertising & Scanning for now.
As a consequence, several methods used are now flagged as deprecated, and some FLAGS have been added (for example in scan results error cases).
changes can be found here:
I think it would be wise to switch to the non-deprecated methods when possible (ie. on Android >=13) because some of those deprecated methods had race conditions / thread safety issues as discussed here. It could also be a complementary fix to the recently merged PR #935.
A good summary of the changes needed might be found in the Nordic lib in the following 2 PRs (both included in latest release, 2.6.0) :
I don't have much time right now but if I can help on that integration, I will.
Also, not directly related, but be aware that the new android 13 scan introduced issues which consequences I'm not yet 100% certain of, but they include:
scan returning only partial data when manufacturing data include padding 0s as documented here, for which a fix was provided by google but not yet deployed to all android 13 devices (samsung devices migrated to tiramisu seem to all have the problem as of today from my own tests).
a seemingly unstable scan behavior of this lib, not respecting the scan duration (scan indefinitely), nor respecting
stopScan
command. It may be related to a new behavior of the underlying android lib with reportDelay=0 causing too much spam on theScanCallback
, and so this lib might have to adjust to the new performance improvements ? still under investigation on my side.The text was updated successfully, but these errors were encountered: