-
Notifications
You must be signed in to change notification settings - Fork 104
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
@config-plugins/react-native-ble-plx broken for some Android phones #149
Comments
This build does not have any extra permissions in app.json, android.permissions is not used at all. So this is leaving the permissions up to the plugin. |
some explanation of the complexity of the issue here: |
It seems like very fine-grained manifest permissions are required for particular sdk versions and android versions, which isn't something that is possible in Expo using the android.permissions field, as far as I can tell. |
I also have in my code
Some Android SDK versions reject some of these permissions (because they don't exist in that SDK). |
Anyone able to help? |
Same problem here. No solution found. |
I made the following changes and it works well, but I had to add a very intense popup at boot, which is getting more negative reviews. This is not the 'correct' way to do it, Android docs are very clear that the app should not request more permissions then what it needs for a specific SDK, and it is possible that this code crashes on some devices (we are getting more crashes now then in the previous version which did not request these permissions). The popup says "This app requires location data to enable Bluetooth discovery and ensure compatibility with all Android devices, even when the app is closed or not in use". It runs before any permissions are requested, this text is taken from the Play Store email explaining the rejection of apps that do not have the popup. They call it a 'prominent disclosure'. My app does not use any location data, so this is very confusing indeed. app.json:
app.js:
|
I tried to use this code to request specific runtime permissions on various SDKs, but there were some devices (Nokia g10) which would still reject scanning. This code is taken from the links I shared above.
|
Thank you! This seems to fix the problem on my test device at least. Just need to test on a few more devices. And write better content to inform the user before the popups show up. |
It would be great to hear from the maintainers of this plugin (if there are any) with some kind of a roadmap on this. Permissions are supposed to be managed by the plugin under Expo, or at least that's my impression? |
Yes, that is my impression too. I have not yet been able to publish a working update to my app yet. Your example did help me to get it working locally. But when submitting the aab-archive to Google Play Console, I get this error instead:
So I guess I have to experiment some more to get this to work. |
I did manage to create a new version that was accepted by Google Play Console.
Previously I had |
Interesting. I found that newer devices needed BACKGROUND_LOCATION. This permission is the one that requires the prominent disclosure. If it's not needed then that is great news. |
I did look into the source code to try understand what this config plugin does. I also checked the generated AndroidManifest.xml file. With no special permissions specified in
Comparing this with the instructions at the Android Bluetooth docs I can see that it is mostly correct. But some issues exists.
The
But this line only specifies that the app requires Bluetooth LE. And is not shown in the store if your device doesn't support this. This line should not be added because of a background setting. The setting sounds like the app needs permissions to use Bluetooth in the background. But the This plugin sets some default values to the manifest, but the plugin doesn't let the full control over the default settings or how they should be overridden. Some examples: 4a.
This made the Google Play Console reject my app, because of the duplicated entries. To solve this, I had to remove my manually added permission, and let the plugin add this location setting. It works, but feels wrong to let a Bluetooth plugin set permissions for other responsibilities of the app. The plugin should handle this and don't create duplicates. 4b. If we don't want the
Bottom line: @EvanBacon Any comments on this? |
Hi can you share a hello world with the React native BLe i cant install it into my project, i just learned how to use custom packages but this one fails. my email is [email protected] |
@olach thanks for the in-depth analysis. Would you be interested in opening a PR addressing some of these issues? |
hey evan can you please share a simple app.js with @config/react-native-ble-plx, would be amazing, i dont want to hire someone overseas. just connected to the package, i've tried for 10 hrs to install it didnt work, i got other plug ins to work |
@kimmyyyyyyyyyyyyy If you look in the source code you will find example apps for the packages: And remember you need to build the app (production build or dev client) to be able to use these native plugins. It will not work in the Expo Go app. |
@EvanBacon I might be able to create a PR for some of the simpler fixes, but I'm not able to do this in the near future because of holidays, other projects etc. But a bigger question is whether or not the plugin should set these permissions automatically or not. Not everyone using this Bluetooth plugin will use/need the same permissions. Therefore a configuration option is needed. But instead of documenting and explaining for the user what each configuration option is doing, why not simply explain for the user what kind of permissions is needed. And how to set them manually in the plugin section in This would of course need some enhancement for how permissions is added in app.json. Right now, it's not possible to specify max/min Android sdk versions for example. |
@EvanBacon us there any hope of us getting the ability to add max/min Android sdk versions to the permissions in app.json? |
@EvanBacon The main issue I am facing is that when I add |
@marchingband Sorry, I did not have time to create a PR for this. And for various reasons I'm not working on this specific app anymore. Hopefully someone else can create a PR to fix these issues. |
Summary
Some android phones do not allow Bluetooth Scan.
The issue is with permissions, although it's so confusing, and so poorly documented, that I havn't got to the bottom of it yet.
There is clearly a more complicated story with permissions then this plugin is handling, for various versions of Android, and various vendor specific tweaks.
If the plugin can't handle the details, then a clear explanation of the issue needs to be added to the readme.
I have an app in the Google Play Store with users reporting issues, and negative ratings piling up, despite testing my app on dozens of android devices, on many different Android versions.
If I add ACCESS_BACKGROUND_LOCATION to my app.json under android.permissions, then Google Play Store has a very serious issue with that, and requires me to disclose this information to the user before the permissions is invoked. Such a disclosure is not something I have ever seen in an app, despite many apps using bluetooth, so clearly something is off. Disclosing that an app is accessing users background location for no reason is not a good look, as the app does not have any need of users location.
here is a list so far of users devices that deny the scan:
- Nokia g10 (Android 10)
- Google Pixel 6 Pro (Android 13)
- Google Pixel 4a (Android 13)
- Galaxy S10+ (Android 12)
- Moto g pure (Android 12)
- Samsung s22 ultra
- Samsung flip 5 (Android 12)
- Galaxy A51 (Android 11)
- Galaxy A52 5G (Android 12)
thank you!!!
Config Plugin
@config-plugins/react-native-ble-plx
What platform(s) does this occur on?
Android
SDK Version
45
Reproducible demo
Any bluetooth app that scans
The text was updated successfully, but these errors were encountered: