Android app: Differentiate "folder deleted" from "permission removed" for this folder

37 Views Asked by At

In my Android app, the user can select a folder thanks to Intent.ACTION_OPEN_DOCUMENT_TREE I can then write files to this folder.

The problem is that the user can delete this folder or remove the permission to access it.

In both cases, I would like to display a message to explain the user what is happening and how to fix this issue.

I need 2 different messages and so I need to differentiate these 2 cases

I wanted to use DocumentFile.exists() but it returns false in both cases.

How can I do that?

0

There are 0 best solutions below