Is it possible for my own document provider to be offered only within my app?

198 Views Asked by At

This is a very short answer, which I couldn't find an answer to, not in in the docs and not anywhere over the Internet:

On Android, apps can offer the user to choose files from them, to be chosen from other apps. For example, the Google Photos app allows to choose photos files from it. This is done by implementing DocumentProvider .

I'd like to ask if it's possible to offer my app's content, only to my app itself.

This can help in the case of providing photos selection, for example, that is relevant only for the app itself.

1

There are 1 best solutions below

5
On

From this docs link: Create a custom document provider

"The attribute android:exported set to "true". You must export your provider so that other apps can see it."

Set android:exported to false inside your manifest.

The DocumentProvider is a ContentProvider so looking at the documentation for ContentProvider will supply a lot more info:

ContentProvider

"false: The provider is not available to other applications. Set android:exported="false" to limit access to the provider to your applications. Only applications that have the same user ID (UID) as the provider will have access to it."