Search code examples
androidfilesystemsandroid-permissions

Is there a way for an Android app to grant permission for another app to access it's storage?


I have read the Android docs, and I am not hopeful, but I thought I would give it a go anyways. Basically, the situation is that I have 2 apps. App A is a content manager that checks on a secured server for content files and downloads them to its storage on the Android device. App B (and any other apps that later may be needed) needs to view the content in App A's storage. Usually FileProvider would be the way I go, but there's a problem with that.

Many of the content files are HTML documents with relative links. FileProvider doesn't give access to every linked file to App B, so links are regularly broken. I am not sure, as it is not my project, if App A can be directed to download to a shared location either.

Is there a way to:

  1. have App A grant what apps are allowed read access to its storage?

  2. have FileProvider grant general read access to a directory and all its sub-directories?

  3. anything else someone might think of to get App B to view the files App A downloads?

or is this, as I fear, currently not possible due to Android restrictions?

Thank you.


Solution

  • As long as both your apps (A and B) are signed with same certificate then you can share resources between each other. This is a common practice within a lot of apps available at play store.

    https://developer.android.com/guide/topics/manifest/permission-element.html#plevel https://developer.android.com/guide/topics/manifest/manifest-element.html#uid