I am trying to share a file (any type of file) from my app with another app in the phone (via the Share menu, for example), or preview it in the phone's default app, but I need to do this without creating a copy of the file in a temp or cache folder to then use the path to create an intent, as it is commonly done.
The difference is that I already have the file in the phone, but it's stored in a custom file system of sorts (this is the app we are working on, and among other things it encrypts the file, which is why the file is not in a regular folder in the phone). I can easily get the file's bytes, create a reader, etc; but so far I have only found the usual way to do what I need: create a temporary file, write the bytes to it, then create an intent with the path to this file, and so on.
Am I missing something?
Is there a way to pass, instead of the path to the file, other kind of abstraction that tells the other app or to Android, to use it to get the file (the bytes?) from a reader or something similar?