Hello,
Welcome to our Microsoft Q&A platform!
The Media.InsertImage
method was deprecated in API level 29. Try using ContentValues
class to achieve the function instead.
if (Build.VERSION.SdkInt >= BuildVersionCodes.Q)
{
var contentValues = new ContentValues();
contentValues.Put(MediaStore.MediaColumns.DisplayName, file_name);
contentValues.Put(MediaStore.Files.FileColumns.MimeType, "image/png");
contentValues.Put(MediaStore.MediaColumns.RelativePath, Android.OS.Environment.DirectoryPictures + "relativePath");
contentValues.Put(MediaStore.MediaColumns.IsPending, 1);
}
Similar issue: https://stackoverflow.com/a/57737524/11083277
Best Regards,
Jarvan Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.