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

Match official requestPermissions interface #1704

Closed
AndreMiras opened this issue Feb 11, 2019 · 4 comments
Closed

Match official requestPermissions interface #1704

AndreMiras opened this issue Feb 11, 2019 · 4 comments

Comments

@AndreMiras
Copy link
Member

The Android API for requesting runtime permission has the following signature:

void requestPermissions (Activity activity,
                String[] permissions,
                int requestCode)

Currently via our PythonActivity.java class, we're providing:

public void requestNewPermission(String permission)

See https://github.com/kivy/python-for-android/blob/02519cc/pythonforandroid/bootstraps/sdl2/build/src/main/java/org/kivy/android/PythonActivity.java#L608
It would be great if our interface was also somewhat matching the official name/signature.

This would be a non-breaking change since we can keep our current requestNewPermission() method and just add the new requestPermissions() one.

@ghost
Copy link

ghost commented Feb 11, 2019

The android module, the only one that directly calls this, is bundled with p4a anyway (in an always-compatible version as a natural consequence). So why would there a need to keep the old signaure around?

@AndreMiras
Copy link
Member Author

Yes that's also a true. Then at least the android permission module should still provide some backward compatible interface. Currently it's def request_permission(permission): and we should also have a def request_permissions(permissions):

@ghost
Copy link

ghost commented Feb 11, 2019

yeah for the android module it makes sense to keep both I suppose (request_permission and request_permissions). As for the strings, even the android module also already takes strings, the predefined constants are just for nicer code and don't need to be actually used (but of course it would need to be taught to also take an array of strings)

@AndreMiras
Copy link
Member Author

Yes that's what I mean, it should take an array of string

AndreMiras added a commit to AndreMiras/python-for-android that referenced this issue Mar 6, 2019
Matches the official Android API via, making it possible to request
multiple runtime permissions at once.

Keeps the previous `android.permissions.request_permission()` interface
for compatibility.

Bumps pyjnius to post 1.2.0 release that solves required method
resolution issues. On 1.2.0, the error was:
```
jnius.jnius.JavaException: No methods matching your arguments, available: []
```
AndreMiras added a commit that referenced this issue Mar 7, 2019
…ermissions

Requests runtime permissions list, fixes #1704
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

1 participant