-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
getDeviceName without bluetooth permission #735
Comments
I like the idea - happy to take a PR so long as it is backwards-compatible + documents that you can use the 'maxSdkVersion' attribute in the manifest when declaring the permission so that doesn't show up for folks that have access to the new API https://developer.android.com/training/permissions/requesting#declare-by-api-level |
I just implemented this for v3 |
Thank you! Sorry I don't have many devices to test with, so didn't implement it myself. |
no problem. works so far on the emulator :-), and the implementation seems sane - I'm an android dev + react-native so I'm comfortable giving it a shot (obviously). Hoping to release an rc1 of v3 in the next day or so and we can all see. |
I went a slightly different way with this one after testing. Previously we were relying entirely on bluetooth name but with permission. This proposed implementation worked but gave a different result, and in the end did not give my phone's actual system name despite it being set (!) So rather than check for API25 and give priority to a new piece of information ("device_name") which apparently does not give great results, I just went with the no-permission-required "bluetooth_name" by itself. Seems to work for me now on emulator and real device, we'll see how the implementation fairs in the wild |
Feature Request
getDeviceName
should be updated to use an api that doesn't require permissions. There is a newer API that allows this. There is also an undocumented way of getting it without the permission.Why it is needed
Adding the Bluetooth permission just to get the device name is unnecessary and confusing to users.
Possible implementation
Code sample
Same as existing but without the Bluetooth permission
The text was updated successfully, but these errors were encountered: