Skip to content
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

Bluetooth permission on iOS is asked on App launch #1219

Open
shettayyy opened this issue May 9, 2024 · 9 comments
Open

Bluetooth permission on iOS is asked on App launch #1219

shettayyy opened this issue May 9, 2024 · 9 comments

Comments

@shettayyy
Copy link

shettayyy commented May 9, 2024

Describe the bug

Bluetooth permission dialog/pop-up opens up as soon as I launch the app. I would prefer the users to see it on the screen where they are using this library rather than showing it on the app launch

To Reproduce
I am using the Expo development build

  1. Install the package
  2. Create an expo development build
  3. Open the app
  4. You should see the permission dialogue pop-up

Expected behaviour
Show the permission dialog where the manager is used/started.

Smartphone (please complete the following information):

  • Device: iPhone 14 Pro Max
  • OS: iOS 17.4.1
  • react-native-ble-manager version: 11.5.3
  • react-native version: 0.73.6
@lucaswitch
Copy link
Contributor

I guess that's the default behavior for iOS for any device using bluetooth. You can customize the message on the infoplist.

@shettayyy
Copy link
Author

shettayyy commented May 10, 2024

@lucaswitch So, there isn't a way to show this dialog where this package is used? There is a possibility of users dismissing the dialog mistakenly. I would prefer to show my dialog component before showing the system dialog for Bluetooth permissions. But, at present, I am not sure if it's possible considering the default behaviour for iOS.

@shettayyy
Copy link
Author

@lucaswitch https://stackoverflow.com/questions/29456654/bluetooth-le-ask-permission

From this post, it seems like it is possible to ask permission when we actually would like to use the feature.

@lucaswitch
Copy link
Contributor

Got it. For doing that is pretty straightforward.
Watch the bluetooth adapter state and make that dialog. If the state is not but "on" then user has to get that dialog. Hope it helps!

@shettayyy
Copy link
Author

shettayyy commented May 14, 2024

@lucaswitch I don't think my app gets the opportunity to check for the state. The pop-up appears as soon as the app opens. I have not written any code to start the Ble manager at the app launch. It appears without calling the Blemanager.start()

So, install the package on Expo (Expo development build) and start the app on an actual device. It asks for Bluetooth permissions as soon as we open the app. I wanna ask it on the page where the Bluetooth feature is being used.

@lucaswitch
Copy link
Contributor

@lucaswitch I don't think my app gets the opportunity to check for the state. The pop-up appears as soon as the app opens. I have not written any code to start the Ble manager at the app launch. It appears without calling the Blemanager.start()

So, install the package on Expo (Expo development build) and start the app on an actual device. It asks for Bluetooth permissions as soon as we open the app. I wanna ask it on the page where the Bluetooth feature is being used.

Not sure quite sure, but i guess that permission you're seeing is prompted by the operating system itself when you add the bluetooth into infoplist.

@jeslo
Copy link

jeslo commented May 22, 2024

I have a related issue in Android. When launching the app, it asks for permission, and I grant it, but the scan is not working. I checked the phone settings, and the permissions are granted. When I toggle the permission off and then on again from my physical device's settings, the scan works perfectly. So, the permission needs to be granted from the physical device settings.

Device: MI 11X
react-native-ble-manager version: 11.5.3
react-native version:0.74.1

@marcosinigaglia
Copy link
Member

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@shettayyy
Copy link
Author

I think this is something to look into as there is quite a possibility of users mistakenly skipping the prompt shown as soon as the app is opened. I don't think it should be closed unless someone reproduces this issue and the prompt is not shown at the beginning in iOS. I humbly request the ability to ask for Bluetooth permission when we use it as opposed to asking when the app opens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants