cris
cris

Reputation: 129

How to move a file from my app's internal storage to the phone's download directory in Android Q (10)?

It seems that getExternalStoragePublicDirectory() is now deprecated, so I need an alternative.

Say I have file the foo.png in my app's internal storage. I can easily access this file with

val foo = File(context.filesDir, "foo.png")

My problem is that I want to move this file to the user's Downloads directory, so that they can see it on their phone.

This answer uses DownloadManager. Unfortunately this is an image I generate myself, not download from somewhere.

Upvotes: 1

Views: 613

Answers (1)

blackapps
blackapps

Reputation: 9282

You have two options.

Use Storage Acces Framework to let the user choose the Download directory .

Use MediaStore to insert file to Download directory.

Upvotes: 1

Related Questions