how to save image to android phone's photo album by xamarin.forms code?

钢 屈 371 Reputation points
2021-07-26T06:45:35.54+00:00

how to save image to android phone's photo album by xamarin.forms code?
Thanks.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,297 questions
0 comments No comments
{count} votes

Accepted answer
  1. Kyle Wang 5,531 Reputation points
    2021-07-27T06:19:48.097+00:00

    Hi 80240195,

    Welcome to our Microsoft Q&A platform!

    What image do you want to save?

    If you want to save the image taken by camera, just set "SaveToAlbum = true" if you used "MediaPlugin".

    var photo = await CrossMedia.Current.TakePhotoAsync(  
    new StoreCameraMediaOptions   
    {   
        SaveToAlbum = true   
    });  
    

    If you want to download the image from url, you can create the DependencyService for android. More details about DependencyService, you can refer to this answer. And here is another thread you can refer to: How to download image and save it in local storage using Xamarin-Forms.?.

    Regards,
    Kyle


    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.

    0 comments No comments

0 additional answers

Sort by: Most helpful