I hope "local file" is even the correct term. I want to load the contents of a file in Resources/drawable in an Android app into a byte array. How?
And should it have a Build Action other than AndroidResource?
I managed to get Xamarin.Essentials installed and working.
Oddly, I had to change the first line in the sample code above to the following:
Stream s = Xamarin.Essentials.FileSystem.OpenAppPackageFileAsync("myfilename").Result;
Other than that, your answer resolved my issue. Thanks.
You could use the assets folder for this and set the build action to AndroidAsset. If you use Xamarin essentials it makes it really easy to get the file contents
Stream s = await Xamarin.Essentials.FileSystem.OpenAppPackageFileAsync(filename);
using (MemoryStream ms = new MemoryStream())
Sounds promising. Next question: How do I get Xamarin Essentials?
Xamarin Inc., as a wholly-owned Microsoft subsidiary acting as a separate legal entity, adheres to the Microsoft Privacy Statement: Privacy & cookies