SavePayload

class NatSuite.Sharing.SavePayload

This payload is used to save items to the camera roll.

To use this payload on iOS, you must define the following keys in your Xcode project's Info.plist file:

  • NSPhotoLibraryUsageDescription

  • NSPhotoLibraryAddUsageDescription

To use this payload on Android, you must specify the WRITE_EXTERNAL_STORAGE permission in your app's manifest. You can do so in Player Settings.

Creating the Payload

/// <summary>
/// Create a save payload.
/// </summary>
/// <param name="album">Optional. Album in which items should be saved.</param>
SavePayload (string album = default);

The save payload can be optionally created to save items within a specific album in the camera roll. If the album does not already exist, it will be created.

Saving to a specific album will only work on Android Q or newer.

Adding Images

/// <summary>
/// Add an image to the payload.
/// Note that the image MUST be readable.
/// </summary>
/// <param name="image">Image to be saved.</param>
ISharePayload AddImage (Texture2D image);

Refer to the Adding Images section of the ISharePayload interface for more information.

Adding Media Files

/// <summary>
/// Add a media file to the payload.
/// </summary>
/// <param name="path">Path to media file to be saved.</param>
ISharePayload AddMedia (string path);

Refer to the Adding Media Files section of the ISharePayload interface for more information.

Saving to the Camera Roll

/// <summary>
/// Commit the payload and return the success value.
/// </summary>
Task<bool> Commit ();

Refer to the Committing the Payload section of the ISharePayload interface for more information.