Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error when downloading to public location on api 28+ #13

Open
akk7777 opened this issue Feb 9, 2021 · 1 comment
Open

Getting error when downloading to public location on api 28+ #13

akk7777 opened this issue Feb 9, 2021 · 1 comment

Comments

@akk7777
Copy link

akk7777 commented Feb 9, 2021

When trying to download to public folders using

destinationInExternalPublicDir: {
        dirType: "Downloads/",
        subPath: "file.pdf"
}

Showing this error
java.lang.IllegalStateException: Not one of standard directories: Downloads

@Umfi
Copy link

Umfi commented May 17, 2021

With API level 29 only the following paths are allowed.

            Environment.DIRECTORY_MUSIC,
            Environment.DIRECTORY_PODCASTS,
            Environment.DIRECTORY_RINGTONES,
            Environment.DIRECTORY_ALARMS,
            Environment.DIRECTORY_NOTIFICATIONS,
            Environment.DIRECTORY_PICTURES,
            Environment.DIRECTORY_MOVIES,
            Environment.DIRECTORY_DOWNLOADS,
            Environment.DIRECTORY_DCIM,
            Environment.DIRECTORY_DOCUMENTS,
            Environment.DIRECTORY_AUDIOBOOKS,

More details can be found here: https://developer.android.com/reference/android/os/Environment#getExternalStoragePublicDirectory(java.lang.String)

So just replace dirType: "Downloads/", with dirType: "Download" and the file should be stored in the public downloads folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants