SavePayload
class NatML.Sharing.SavePayload : IDisposable
The SavePayload
is used to save items to the camera roll.
Requesting Permissions
Before creating a SavePayload
, you must ensure that the user has granted your app permissions to write to the camera roll. Use this method to request permissions.
To use this payload on iOS, you must define the NSPhotoLibraryUsageDescription
key in your Xcode project's Info.plist
file.
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
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
The AddImage
method adds an image to be shared.
Ensure that the added image.isReadable
.
Adding Media Files
The AddMedia
method adds a media file at a given path
.
This method can be used to add audio, image, and video files.
Saving to the Camera Roll
The Save
method saves the payload contents to the camera roll. The returned tasks completes with a bool
indicating whether the save operation was successfully completed.
Disposing the Payload
Once the payload has been used, it must be disposed.
Last updated