I\'m using a Samba File Server for copy files from my Android device to a shared folder on Windows. With .txt files i haven\'t any problems, works fine, but I tried to copy a .j
You can use Media.Plugin from nuget to take photo firstly.
var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
{
PhotoSize = PhotoSize.Medium,
});
public byte[] ReadFully(Stream input)
{
byte[] buffer = new byte[16*1024];
using (MemoryStream ms = new MemoryStream())
{
int read;
while ((read = input.Read(buffer, 0, buffer.Length)) > 0)
{
ms.Write(buffer, 0, read);
}
return ms.ToArray();
}
}
MediaFile
has GetStream().
You could use this to the Stream and then convert that to a byte[]. Here is one way to do that:
Stream imageStream;
imageStream = file.GetStream();
var imageArr= ReadFully(imageStream );
And then write it to your folder .