I am newbie in Xamarin. I am developing an application in Xamarin.forms but have written a small native code in Xamarin.Android to download an image in Android Device. Now the problem is I am able to download image to Phone storage of device but it does not appear in Gallery but it is present in phone storage I can see it in file manager. Can anyone please suggest what am I doing wrong here. Below is my code:
public void DownloadFile(byte[] data, string fileName, string fileType, string attachmentUrl)
{
string localPath = string.Empty;
if (fileType == CAN.Model.Enums.FileTypes.Image.ToString())
{
localPath = Path.Combine(Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryPictures).AbsolutePath, fileName);
}
File.WriteAllBytes(localPath, data);
}