Quote:
Originally Posted by stumped
this is what I can't get my head around , if true.
lets say I just about squeeze a 4Gb HD video into the downloads folder of my android 9 tablet,
and I want to use a file explorer app to find it and hand it off to a video player,
its insane if that 4GB file then has to be copied / moved not pointed at. Even if there is sufficient storage to host a copy, it would take minutes, not seconds to made and hand off such a copy.
|
Here is what Google says. The relevant section is:
Quote:
Sharing Files Between Apps
For apps targeting Android 7.0, the Android framework enforces the StrictMode API policy that prohibits exposing file:// URIs outside your app. If an intent containing a file URI leaves your app, the app fails with a FileUriExposedException exception.
To share files between applications, you should send a content:// URI and grant a temporary access permission on the URI. The easiest way to grant this permission is by using the FileProvider class. For more information on permissions and sharing files, see Sharing Files.
|
A "content provider" in Android does exactly what it says, provides the content as a stream (or a database, but that isn't of interest for a book reader). If the recipient wants to be able to move around in the stream, for example re-read a chapter, then the recipient must make a local copy. Because permissions are temporary, if the recipient wants to be able to open the file again later then it must make a copy. If the recipient is happy to stream it once then no copy is needed.
When the problem arose I looked at the code in Android. There are no exceptions. And yes, this sucks as much as you think.
It is also the way iOS works. It sucks there too.