-
Notifications
You must be signed in to change notification settings - Fork 300
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 permissions #1621
Comments
Ok, here are some notes about android permission versions, that might be of interest to someone.
# Permissions for APIs 29 to 34. Some of them only for APIs up to 30
android.permissions = android.permission.INTERNET,android.permission.BLUETOOTH_ADMIN,android.permission.BLUETOOTH_CONNECT,android.permission.BLUETOOTH,(name=android.permission.BLUETOOTH_SCAN;usesPermissionFlags=neverForLocation),(name=android.permission.ACCESS_FINE_LOCATION;maxSdkVersion=30),(name=android.permission.ACCESS_COARSE_LOCATION;maxSdkVersion=30)
android.api = 34
android.minapi = 29
if platform != 'android':
return # or whatever suits you....
from android import api_version
from android.permissions import request_permissions, Permission, check_permission
permissions_list=[
#Permission.INTERNET,
Permission.BLUETOOTH_ADMIN,
Permission.BLUETOOTH_SCAN,
Permission.BLUETOOTH_CONNECT,
]
if api_version < 31:
permissions_list.append(Permission.ACCESS_COARSE_LOCATION)
permissions_list.append(Permission.ACCESS_FINE_LOCATION)
permissions_list.append(Permission.ACCESS_BACKGROUND_LOCATION) # If needed
request_permissions(permissions_list) |
I agree that Bleak should not be dealing with Android permissions. It should be up to the individual application to deal with that. So I would be happy to take a pull request that removes permission stuff from the android backend code and moves it to the example app. |
Maybe you could just put the android permissions code inside an if, something like this:
Then I just would have to define that variable before importing bleak? |
I would rather that it be an explicit function rather than something that happens magically at import. |
Well, it would not really be in the import, the |
Given that things are kind of broken anyway on newer android versions, I think it would be OK to make a breaking change in this case. |
Hello again!
Description
I have an android app that works very well with bleak (good start :-))
The app does not require location data. It only uses BLE to scan and connect to LEGO Hubs.
But bleak forces permissions
ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION, ACCESS_BACKGROUND_LOCATION
.Location permitions are a problem if you intend to do an android app that can be used by children.
Android offers the ability to "strongly assert that my app does not use location" (check point 5 here).
According to the same page, I am also convinced that in some situations
ACCESS_BACKGROUND_LOCATION
is also not needed. My case in particular.Testing
I tried all this by making a copy of bleak and just commenting the call to the
request_permissions()
(and followingawait
) and using these buildozer permissions (check the special case forBLUETOOTH_SCAN
):And everything works fine!!
Is there a chance that you could find a way to omit the call to
request_permissions()
if the user wants that? Some parameter valid only for android, or something like that?I would appreciate it very much!
Thanks in advance!
VascoLP
The text was updated successfully, but these errors were encountered: