Saving to the Camera Roll

Capturing the Best Moments

NatShare supports saving images and other media to the camera roll. The first step in saving media to the camera roll is requesting permissions from the user:

// Request camera roll permissions from the user.
var granted = await SavePayload.RequestPermissions();

Once permissions have been granted, create a SavePayload:

// Create a save payload
using var payload = new SavePayload(album: "My Awesome App");

You can optionally specify an album name where media will be saved.

The payload is a write-only collection of items to be saved to the camera roll. Currently, the payload supports images (Texture2D) and media files (with file paths):

// Add image
payload.AddImage(texture);
// Add a media file
payload.AddMedia("/path/to/video.mp4");

Once all the items have been added to the payload, they can then be saved to the camera roll:

// Save to the camera roll
var success = await payload.Save();

Last updated