2

I have written an app with xamarin but have run into a snag. I was allowing the user to backup their data to an external card on a samsung device. The path was /storage/extSdCard This of course stopped working with KitKat. From what I can read in the docs is the application should be allowed to freely write to: /storage/extSdCard/Android/data/package.name

However, when I look on the card, there is no folder there with my package name, there are other apps. I do have write/read external permission set in the manifest.

I also tried to create the package folder under Android/data but get permission errors.

Can someone point me in the write direction? How do I get a folder under extSdCard/Android/data/

Thanks.

Phunction
  • 103
  • 2
  • 6
  • You shouldn't use paths by name. In Android you would use `getExternalStorageDirectory()` and it is important to check if external storage is available first. See: [External storage docs](http://developer.android.com/guide/topics/data/data-storage.html#filesExternal) I don't know what the Xamarin equivalent is. – pjco Sep 16 '14 at 00:37
  • Hi, getExternalStorageDirectory() always returns the internal storage card on a samsung, not sure about other devices. – Phunction Sep 16 '14 at 01:19

1 Answers1

2

Turns out to be simple, just calling GetExternalFilesDirs(null); will automatically create the folder.

Phunction
  • 103
  • 2
  • 6
  • `GetExternalFilesDir(null)` returns a list of strings. The first one will be internal storage. Second string in the array would be the external SD card (if one is available). – SaiyanGirl Nov 30 '16 at 18:46