Xamarin-System.UnauthorizedAccessException: Access to the path is denied

前端 未结 4 1388
天涯浪人
天涯浪人 2020-11-28 14:08

I\'m trying to download a file and I\'m getting System.UnauthorizedAccessException: Access to the path \"/storage/emulated/0/Download/test.pdf\" is denied. I have set requir

4条回答
  •  难免孤独
    2020-11-28 14:11

    Those of you who are facing this issue after your app is Targeting API29 or higher, please go to this link and check LandLu's Answer:

    https://forums.xamarin.com/discussion/171039/saving-files-to-external-storage

    Earlier I was accessing Folder path using return Android.OS.Environment.ExternalStorageDirectory.AbsolutePath; But using this line solved my problem: return Android.App.Application.Context.GetExternalFilesDir("").AbsolutePath;

提交回复
热议问题