I am targeting Android API 30. My app was storing log file and taking database backup in location "/storage/emulated/0/SpecialDir/". Now I am facing access denied issue while my app was workinng fine previously. I got an overview about scoped storage and came to know that we have some managed locaitons where we can store our data accordingly. i.e Audio, Video, Images, and Download
- My question is What is the solution for existing apps that was previously saving files on "/storage/emulated/0/SpecialDir/".
Can anyone please guide me what should i do.
string dir = Path.Combine(Android.OS.Environment.ExternalStorageDirectory.ToString(), "LogFolder"); if (Directory.Exists(dir)) { return Path.Combine(dir, "MyLogFile.txt"); } try { string newDirectory = Directory.CreateDirectory(dir).FullName; path = Path.Combine(newDirectory, "MyLogFile.txt"); System.IO.File.WriteAllText(path, "This is some testing log."); } catch (Exception ex) { string msg = ex.Message; } The above code is used to make 'LogFolder' if not exist and 'MyLogFile' as well. What changes do i needed to make it compatiable to Android 10. Thankyou