-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Content providers #2200
base: develop
Are you sure you want to change the base?
Content providers #2200
Conversation
Just opened kivy/buildozer#1119 as an example of how the two new Please consider following up on either this PR here or on #1922, so that there is an easy way to setup content providers in a Kivy app. |
Thanks @pavelsof for the PR, looks clean. |
@@ -92,6 +92,10 @@ | |||
</intent-filter> | |||
</receiver> | |||
{% endif %} | |||
|
|||
{%- if args.content_providers -%} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why {%- rather than just {% (and same elsewhere)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No other reason apart from not being familiar with Jinja and copy-pasting the lines that render the intent filters. I will fix it.
'filename containing xml. The filename should be ' | ||
'located relative to the python-for-android ' | ||
'directory')) | ||
ap.add_argument('--add-xml-resource', dest='add_xml_resource', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't we add something else recently for moving stuff into the src/main/res folder?
I'm wondering if what we really want is a generic "copy this file/folder into src/main/res" argument, rather than many arguments for different subfolders.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can replace it with a more generic argument to copy files/directories into src/main/res
.
I believe this is more generic version of my pr #1922. Maybe this one is better, as it is more flexible. But please note that I had to add more Gradle build flags for this to work. (See my original pr) |
@AndreMiras, I agree, it would be better if the option name makes it clear that it can be used to insert arbitrary XML in the @Fak3, thank you for jumping in! Indeed, just as you did, I also had to add |
Thanks guys for the discussion! |
@AndreMiras, yes, #1922 works for me. It would be slightly easier to use as well, because a Kivy developer would only need the paths XML, but not the |
This would be great if this was signed off and 'dozer supported the args, I just did it by hand and inserted :
Also I used I tested build and execution on api 27, 29, and 30 all good Arbitrary html would be a good thing in general. |
FYI, the steps to move from the depreciated packages to androidx #2020 (comment) |
Ping! This is a polite reminder/request to please merge this PR. I have been using my python-for-android and Buildozer forks for a pet Kivy app, and there have not been problems for what is now almost a year. Content providers constitute an important thing in Android and Kivy should be able to work with them. |
I believe we have to fix #2385 first, it would not work without it |
It works (at least for me) with the older, probably deprecated by now, What can we do to prod the core maintainers to say what is wrong with either PR? 😕 |
I wish I knew the answer to that question 🤔 If #2385 where approved (sigh) then support here for both versions might look like this:
|
As an enhancement I suggest a default For example the attached File belongs in |
Instead of Why not keep everything thing as Adding two parameters |
Is this what you want? Also there is at least one xml related PR #2330 that sits and rots :( |
Yes, i wanted this. It would be better if it also integrates addition of
#2330 is also a very specific case where he wants to insert intent filters manually but automating the modification of manifest file. |
I think the most generic thing to address all cases will be to allow p4a use custom manifest template file, via an option --manifest=/path/to/mymanifest.xml.tmpl |
There are some things important in default manifest file. So for using a
custom manifest file, a user has to study the manifest lying under the hood.
I argue that if he can go there, then what is the use of providing options,
he can directly do additions right there only.
…On Thu, 11 Mar, 2021, 11:33 pm Evstifeev Roman, ***@***.***> wrote:
I think the most generic thing to address all cases will be to allow p4a
use custom manifest template file, via an option
--manifest=/path/to/mymanifest.xml.tmpl
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2200 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANZGQCHIUQWTAJQ5SDHC6DTTDEAVLANCNFSM4NBCEUQA>
.
|
I just asked "Has content providers been incorporated in p4a?" on https://groups.google.com/g/kivy-users/c/7VVYdkA0gjQ - and received this answer by RobertFlatt : I think the whole content provider thing faded to irrelevance, turned out that the MediaStore can provide a uri. I wrote this as a test case: https://github.com/Android-for-Python/Share-Send-Example |
So how this can help with plyer camera, which requires fileprovider to work? |
@Fak3 You want to save an image to shared storage on Android >= 10? I wrote a Camera Widget that on Android can save screen shots to public storage (for photos the widget uses native image capture that handles this). https://github.com/Android-for-Python/Camera4Kivy The save and copy code is here https://github.com/Android-for-Python/Camera4Kivy/blob/main/src/camera4kivy/preview_camerax.py#L224-L253 |
I want it to be compatible with Android 7 |
You don't say what "it" is, but if "it" is save a file then on Android <10 shared storage is a file system. |
I want to capture a photo with external camera app. On Android 7 it throws an error when you just try to give an external app a filesystem path to save an image to. It only works if you properly define fileprovider in your Android manifest. |
See kivy/plyer#549 |
Yep, Plyer Camera looks like it has had bit rot for several years. The design approach is obsolete. I see that you would have that issue. |
Working approach for Android 7 is still needed. It will take years for users to switch to Android 10 |
This PR should make it possible to add content providers to the Android manifest. Two options are added to the common
build.py
script:--content-providers
is practically identical to the--intent-filters
option, it expects the path to an XML file the contents of which are included in theAndroidManifest.xml
.--add-xml-resource
can be used to copy one or more files over to thesrc/main/res/xml
subdir of the build dir. This is needed because<provider>
elements in the Android manifest usually have to refer to another XML file that defines the paths the app is allowed to "export".If approved, I will also prepare a PR for the Buildozer repo to add the
buildozer.spec
counterparts.