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

Add optional android fileprovider. #1922

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Conversation

Fak3
Copy link
Contributor

@Fak3 Fak3 commented Jul 15, 2019

https://developer.android.com/reference/android/support/v4/content/FileProvider

If the option --fileprovider-paths=./mypaths.xml is given, then this xml file is
copied to apk res/xml/file_paths.xml and <provider> is added to the AndroidManifest.xml

@sanderland
Copy link

Has this been ignored and abandoned, or has anything similar made its way in? Struggling to have my kivy app open an external app.

@kollivier
Copy link
Contributor

Flagging that we are using this support as well and it would be nice if we could get it merged! :)

@pavelsof pavelsof mentioned this pull request May 21, 2020
@RobertFlatt
Copy link
Contributor

I'm trying to share a file on Android 10, which seems pretty basic functionality.

But permissions means I need to create a 'content' Uri rather than a 'file' Uri.

Seems the only way to do this is via a ContentProvider such as FileProvider, but this requires androidx.

So

  1. This is really important, file 'share' is basic functionality. Thank you.
  2. Consider defaults for the xml files, a Python user is here because they don't want to think about that stuff.
  3. The Android docs say ContentProvider must be sub classed, but anything I try to do in pyjnius wont be seen in Java. And if I try to instance ContentProvider, I get:
    JNI DETECTED ERROR IN APPLICATION: can't make objects of type android.content.ContentProvider: 0x712ee630
    So a minimal Python/pyjnius example would be really helpful.

Thanks again.

@AndreMiras
Copy link
Member

@Fak3 thank you for the pull request and sorry that it wasn't reviewed earlier.
Thanks also to the other to show interest regarding the feature.
Before we can merge it could you address the following?

Ideally squash the commits after addressing so the PR is still one commit

@wajdyz
Copy link

wajdyz commented Sep 11, 2020

Seems to be a must API 30 onwards.
More restrictions by Google now on using storage

@antocuni
Copy link

Unfortunately the original branch has conflicts with the develop branch of p4a. I rebased it on top of the latest version (6ed7023) and published the rebased branch here:
https://github.com/antocuni/python-for-android/tree/fileprovider-rebased

See also this example to see it in action:
https://github.com/antocuni/plyer_camera_example

@Zen-CODE
Copy link
Member

@Fak3 Any word on resolving the conflicts? Would be nice to get this in.....

@Android-for-Python
Copy link

There is another way to generate a uri : uri = context.getContentResolver().insert()

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.

9 participants