1

After updating to Android 6.0.1 i can't find the files on my sdcard programmatically.

The SD Card directory shows now "storage/9C33-6BBD/"

After this path I has my data. How i can get them ?

System.getenv("SECONDARY_STORAGE");System.getenv("EXTERNAL_STORAGE")Environment.getExternalStorageDirectory()

Doesn't work

Before updating Androiud it works well.

Bukmop
  • 37
  • 5
  • You have not had direct arbitrary access to removable storage since Android 4.4. – CommonsWare Sep 27 '16 at 15:32
  • ?? under Andoird 5 i can read and write data from external storage – Bukmop Sep 27 '16 at 15:38
  • You can read/write from `Environment.getExternalStorageDirectory()`, with the proper permissions. External storage is not removable storage. – CommonsWare Sep 27 '16 at 15:47
  • Don't forget in Android 6 there is also a required runtime permission request in addition to being in manifest (external storage is a "dangerous" permission); external storage just got more tricksy to use.... See this answer for some details http://stackoverflow.com/questions/33162152/storage-permission-error-in-marshmallow See this topic for background https://developer.android.com/training/basics/data-storage/files.html – escape-llc Sep 27 '16 at 16:25
  • You can avoid these checks by setting target SDK lower than 23. – escape-llc Sep 27 '16 at 16:33

1 Answers1

0

Have a look at getExternalFilesDirs(). It will give two paths. The second one in on the sd card.

greenapps
  • 11,154
  • 2
  • 16
  • 19