question

80240195 avatar image
0 Votes"
80240195 asked KyleWang-MSFT answered

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

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

dotnet-xamarin
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

KyleWang-MSFT avatar image
0 Votes"
KyleWang-MSFT answered

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.