5

Working on android Java, recently updated SDK to API level 29 now there is a warning shown which states that

Environment.getExternalStorageDirectory() is deprecated in API level 29

so we have to use getExternalFilesDir() but returns like this /storage/emulated/0/Android/data/yourpacakgeName/files/Download/demoform1 (1).pdf

I want to get the real path from download phone: /storage/emulated/0/Download

can anyone help to read real path download folder

  • do you want to know the directory of stored file? – Deepak Tripathi Jan 15 '20 at 12:01
  • /storage/emulated/0/Download want to read files and get real path from download folder @DeepakTripathi – Priyanka Chauhan Jan 15 '20 at 12:03
  • `MediaStore` offers `MediaStore.Downloads` on Android 10. If all you want to do is read and write your own content that you place into `Downloads`, then you can use that. You cannot use it to examine other apps' content in `Downloads`. See [this blog post](https://commonsware.com/blog/2020/01/11/scoped-storage-stories-diabolical-details-downloads.html) for more details. – CommonsWare Jan 15 '20 at 12:09
  • `You cannot use it to examine other apps' content in Downloads` @CommonsWare. Yes other apps can with mediastore. In the Image, Audio and Video collection they will appear If they are images, audio or video files. Pdf's and doc and so on are safe. It looks as if the documentation is not complete. Tested on Android 10 emulators. – blackapps Jan 15 '20 at 12:18
  • "In the Image, Audio and Video collection they will appear If they are images" -- those are not the `Downloads` collection. There, it appears you only have access to your own content. "It looks as if the documentation is not complete" -- my own experiments back up the documentation. This is covered in [the blog post that I linked to](https://commonsware.com/blog/2020/01/11/scoped-storage-stories-diabolical-details-downloads.html). If you have a technique for reading the content of other apps' from `Downloads`, please post it! – CommonsWare Jan 15 '20 at 12:25

0 Answers0