简体   繁体   中英

How to save Files in Android/Media/MyFolder in Android11 and above

Hy everyone, I am new to SAF and know how to get uri from Intent.ACTION_OPEN_DOCUMENT_TREE.I have checked my logcat and receive the URI as content://com.android.externalstorage.documents/tree/primary%3AAndroid%2Fmedia%2Fcom.whatsapp%2FWhatsApp%2FMedia%2F.Statuses. Suppose I want to make a folder and save downloaded files. How can I achieve this? How can I tell DownloadManager to download to this URI. Is there any other way to achieve the same then Please tell me. Thanks

In the normal way as usual.

Instantiate a DocumentFile instance for the obtained uri and then use createFile on it to make your subfolder.

There is no possibility to let DownloadManager download to that folder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM