Skip to content

Make AndroidCamera compatible with android API >= 24#649

Open
antocuni wants to merge 2 commits into
kivy:masterfrom
antocuni:antocuni/android-24-camera
Open

Make AndroidCamera compatible with android API >= 24#649
antocuni wants to merge 2 commits into
kivy:masterfrom
antocuni:antocuni/android-24-camera

Conversation

@antocuni

Copy link
Copy Markdown

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

…pecify a

FILEPROVIDER_AUTHORITY and to get the uri accordingly
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