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

Android 12 / targetSDK 31 should give hint about actual permission missing #805

Open
danielRi opened this issue Jul 15, 2022 · 3 comments
Open

Comments

@danielRi
Copy link

danielRi commented Jul 15, 2022

Describe the bug
Location Permission for Android 12 is optional (targetSDK needs to be >= 31). See https://developer.android.com/guide/topics/connectivity/bluetooth/permissions#declare-android12-or-higher
The library however forces FINE_LOCATION to be set.

To Reproduce
Steps to reproduce the behavior:

  1. Remove <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> from Manifest
  2. Increase targetSDK to at least 31
  3. Start App without asking for location runtime permission
  4. Perform any bluetooth related scan with the library. e.G. scanning
  5. An error is thrown Caused by: com.polidea.rxandroidble2.exceptions.BleScanException: Location Permission missing (code 3)

Expected behavior
For Android 12 Devices, when targetting API 31, setting location is optional. The library should not force location permission to be set.

Smartphone (please complete the following information):

  • Device: Samsung S22 Ultra
  • OS: Android 12
  • Library version: [1.13.1]

Logs from the application when bug occurs (this will greatly help in quick understanding the problem)
To turn on logs use:

`Caused by: com.polidea.rxandroidble2.exceptions.BleScanException: Location Permission missing (code 3)`

Additional context
compileSdkVersion = 32
buildToolsVersion = "30.0.2"
minSdkVersion = 24
targetSdkVersion = 32

@danielRi danielRi added the bug Bug that is caused by the library label Jul 15, 2022
@dariuszseweryn
Copy link
Owner

Do you have BLUETOOTH_SCAN permission granted?

@danielRi
Copy link
Author

danielRi commented Jul 18, 2022

hey @dariuszseweryn :)

No I have not. I see this fixes the issue. Thank you! Maybe the error "Location Permission missing" is not ideal, but not gonna complain about it since it´s working now.

@dariuszseweryn
Copy link
Owner

Yeah, I will need to think if an alternative wording should be used or whether it would be a braking change

@dariuszseweryn dariuszseweryn added enhancement and removed bug Bug that is caused by the library labels Jul 19, 2022
@dariuszseweryn dariuszseweryn changed the title Android 12 / targetSDK 31 still requires ACCESS_FINE_LOCATION, should work without it Android 12 / targetSDK 31 should give hint about actual permission missing Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants