0

I have created a Custom DocumentsProvider for my Android app. How can i make this private, so that it's exclusively accessible in my own app where it is declared.

  1. I tried making exported = False i get a security Exception.
  2. I tried to create new custom permission and use it in my provider tag in manifest, checking if this permission is granted or not before doing anything in DocumentProvider's methods.

But my DocumentsProvider is still accessible to all other apps. How to make this accessible exclusively in my app.

user38561
  • 1
  • 2
  • I am fairly certain this is not an option. Why did you create a custom `DocumentsProvider`? What problem are you trying to solve? – CommonsWare Aug 07 '23 at 12:49
  • I have created CustomDocumentsProvider by extending DocumentsProvider. I need to display few Documents and folders in my app, i want to use the system Ui for Displaying the files and do all other operations. Only thing is i don't want to expose my File and folder structure to other apps in the Device. i took the StorageProvider, StorageClient apps as reference from https://github.com/android/storage-samples. Trying to combine these apps to one. – user38561 Aug 07 '23 at 13:03
  • "i want to use the system Ui for Displaying the files and do all other operations. Only thing is i don't want to expose my File and folder structure to other apps in the Device" -- as far as I know, those two objectives conflict with one another. – CommonsWare Aug 07 '23 at 13:06
  • At one point, From Apps like whatsapp if i try to pick a file, default System ui with some Files and Folders was displayed and my provider was listed along with other apps like Google Drive, when i clicked on my provider name none of the files are displayed, which is what expected. But when i tried to list/browse files from my app the same thing happened. I am missing some thing here, I can control when my Documents provider can return data and when it can return null. That check is what i need to fill where it can check that if the call is from my app or other app. – user38561 Aug 07 '23 at 15:23
  • Now my app and all others either see my data or don't see my data. If i can add my app specific check and return data to my app and for others return null or some other value. It is possible to achieve this. I tried to check it using app specific permissions granted or not but it didn't workout. I am not sure but feel like there should be some way. – user38561 Aug 07 '23 at 15:33
  • @CommonsWare you are right, it's not possible. Thanks for responding. – user38561 Aug 10 '23 at 12:19

0 Answers0