Skip to content

Save to Gallery

levching edited this page Apr 15, 2020 · 3 revisions

You may save any Texture2D to the gallery. The only limitation, that texture has to be readable.

In the example below, I am going to use SA_ScreenUtil.TakeScreenshot in order to generate app screen screenshot and save it to the gallery. However, you may use any other way to get the picture you want to add into the user phone gallery.

using SA.Foundation.Utility;
using SA.Android.Gallery;
...

SA_ScreenUtil.TakeScreenshot((screenshot) => {
    AN_Gallery.SaveImageToGallery(screenshot, "Example Scnee", (result) => {
        if (result.IsFailed) {
            AN_Logger.Log("Filed:  " + result.Error.Message);
            return;
        }

        AN_Logger.Log("Screenshot has been saved to:  " + result.Path);
    });
});
Clone this wiki locally