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

fix-gps #537

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

fix-gps #537

wants to merge 9 commits into from

Conversation

chris-hamberg
Copy link

Fix for programmatically requesting permissions (required for Android API 23 and greater,) particularly for GPS on Android. TL;DR: this makes GPS work again, on Android!

In order for this fix to actually work some other parts of the Kivy framework also require minor patches. As they are specified in buildozer.spec the following values must be set:

android.api = 29
android.gradle_dependencies = 'com.google.android.gms:play-services-location:17.0.0'

It would be nice it could be possible to parse the permissions from buildozer.spec during build, and package it with a text file in the APK, or a simple AndroidManifest.xml parser that plyer could read on initialization. That way, the Manifest list in init could properly be populated with all of the necessary permissions in one place, in case additional endpoints require this patch.

…ndroid.permission.PERMISSION (as the occur in the standard AndroidManifest.xml).
…, and Manifest from plyer.platforms.android.__init__
This merge repairs GPS on Android, and supports programmatic permissions as mandated by
the Android API.

A few changes will are required in the gradle build and target API. Namely (and as
specified in buildozer.spec):

android.api = 29

android.gradle_dependencies = 'com.google.android.gms:play-services-location:17.0.0'

I recommend placing these values 'under the hood' so-to-speak, so that the
buildozer.spec remains clean.
@ghost
Copy link

ghost commented Mar 21, 2020

Hello! Thanks for the pull request.

I see you're trying to do something similar to #529, but in the constructor. To request permissions at runtime, you can use android.permissions.request_permissions in the build method, just like the pull request I mentioned

It would be nice it could be possible to parse the permissions from buildozer.spec during build, and package it with a text file in the APK, or a simple AndroidManifest.xml parser that plyer could read on initialization. That way, the Manifest list in init could properly be populated with all of the necessary permissions in one place, in case additional endpoints require this patch.

request_permissions accepts a callback that is called when the permissions are accepted or denied.

In summary, it seems like a duplicate of #529, unless the example showed in there is not working.

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

Successfully merging this pull request may close these issues.

None yet

1 participant