How I set the ACTION_OPEN_DOCUMENT_TREE start path the first time a user uses my app?


I’ve seen a lot of questions regarding setting the start uri for the Intent.ACTION_OPEN_DOCUMENT_TREE but all of those require a uri that comes from having used that folder picker before.

What I want to do is send my users directly to the Download folder when picking the folder but I do not know how to convert /storage/emulated/0/Download to a uri that I can pass as an extra using DocumentsContract.EXTRA_INITIAL_URI.

Is there a way to convert any file path to a DocumentsContract style uri?

Source: Android Questions