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

Make AndroidCamera compatible with android API >= 24 #649

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

Conversation

antocuni
Copy link

This should finally fix #500 .

On modern android versions, the only way use the ACTION_IMAGE_CAPTURE intent is to use fileproviders, and somehow we need to tell plyer which fileprovider authority to use. I don't think there is a general mechanism to configure per-platform settings in plyer, so in the PR I adopted for the following API:

from kivy.utils import platform
import plyer
if platform == 'android':
    plyer.camera.FILEPROVIDER_AUTHORITY = '...'
plyer.camera.take_picture(filename, ...)

This works as long as filename has a proper configured fileprovider, which is not possible with the current p4a version.
The easiest way is to use kivy/python-for-android#1922.

I also published a fully working example which combines this PR, kivy/python-for-android#1922 and kivy/buildozer#1369:
https://github.com/antocuni/plyer_camera_example

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.

Error in access camera android.
1 participant