In Android there are a collection of Environment paths available at Android.OS.Environment. However, when keeping cross platform capabilities in mind, I want to store pictures in a pictures folder and so thought to use System.Environment.GetFolderPath instead. However, my question is where these all point to in an Android environment. Can I get a useful pictures folder from the following?
string path = Environment.GetFolderPath (Environment.SpecialFolder.MyPictures);
To access this page, select a project node in Solution Explorer, select Project > Properties from the Visual Studio menu, and then select the Environment Variables tab. Specifies the name of an environment variable that will be used when the project is built or when the project is run from Visual Studio.
The SetEnvironmentVariable(String, String, EnvironmentVariableTarget) method lets you define an environment variable that is available to the current process (the Process value). Environment variables that are unique to the current process environment block persist only until the process ends.
After stepping through some code, I've summarised the locations given by Xamarin Android for each of the different System.Environment variables below. I don't have an iOS project available, but if anyone could post the iOS equivalents I'd be grateful.
ApplicationData "/data/data/ProjectName.ProjectName/files/.config"
CommonApplicationData "/usr/share"
CommonProgramFiles ""
Cookies ""
Desktop "/data/data/ProjectName.ProjectName/files/Desktop"
DesktopDirectory "/data/data/ProjectName.ProjectName/files/Desktop"
Favorites ""
History ""
InternetCache ""
LocalApplicationData "/data/data/ProjectName.ProjectName/files/.local/share"
MyComputer ""
MyDocuments "/data/data/ProjectName.ProjectName/files"
MyMusic "/data/data/ProjectName.ProjectName/files/Music"
MyPictures "/data/data/ProjectName.ProjectName/files/Pictures"
MyVideos "/data/data/ProjectName.ProjectName/files/Videos"
Personal "/data/data/ProjectName.ProjectName/files"
ProgramFiles ""
Programs ""
Recent ""
SendTo ""
StartMenu ""
Startup ""
System ""
Templates "/data/data/ProjectName.ProjectName/files/Templates"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With