Currently I am trying to load file "json" from my Android project, using Xamarin.Forms.
Here is my code:
var path = @"client_secret.json";
using (var stream = new System.IO.FileStream(path, System.IO.FileMode.Open, System.IO.FileAccess.Read))
{
}
For path I tried many different cases to place "client_secret.json" in project root folder, assets folder, bin, bin>Debug, bin>Release as well for ".Droid" project and PCL too. I tried also to change file build action to "Content", "Embedded Resource", "Additional Files", "AndroidResource" and "AndroidEnvironment". I tried also to change "client_secret.json" and use physical path (D:\Apps....\Project.Android\client_secret.json) and try to find it in different folders:
Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryDownloads).AbsolutePath
Directory.GetFiles(Directory.GetCurrentDirectory())
Directory.GetFiles(Android.OS.Environment.RootDirectory.AbsolutePath)
Directory.GetFiles(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal))
And still nowhere I find it. "Copy to output" file property is changed to "Copy always" and still no result.
Does anybody know what I am doing wrong in that case to make FileStream on this file?
Thanks in advance