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

[Feature Request] Change ACTION_GET_CONTENT function to use content provider on older Android versions #84

Open
joriswit opened this issue Nov 24, 2024 · 0 comments

Comments

@joriswit
Copy link

When calling the app using the ACTION_GET_CONTENT intent, I have noticed the app returns a content provider on Android N (API 24) and above. On older versions it simply returns the file url. (see FileOpener.getUriFromFile)

I think it would be nice to lower the version where a content provider is returned. Since the app returns the FLAG_GRANT_READ_URI_PERMISSION flag in the intent, the app which initiated the request expects to be able to read the selected file. But unless the app has READ_EXTERNAL_STORAGE permission, it cannot. If a content provider was used, it could still open the file. I am not sure what the argument is for returning a file url, perhaps content providers are not supported on older versions?

An alternative is to not include the FLAG_GRANT_READ_URI_PERMISSION flag when a file url is returned. The calling app then still can't open the file, but at least it knows.

I have tested this on Android 4.4.

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

No branches or pull requests

1 participant