Attachments
You can use the attachments feature to include media with your activity report statements. These attachments can be images, video or audio.
Attachments must be enabled for your organization in order to use this feature.
Attachments can be attached to any report statement. To do this, first create an attachment. This requires a byte array for your file or its path, a name, a description and the ‘content type’. The example below shows how you can create a PNG Attachment from a Texture2D.
const string title = "Image Example";
const string description = "This is an example of an image attachment";
var bytes = image.EncodeToPNG();
var attachment = Attachment.Create(bytes, title, description, ContentType.PNG);
The ContentType
static class outline the supported content types by the Immerse platform’s reporting front end. If no content type is provided, the SDK will attempt to identify the type, but it is recommended that you provide this yourself where possible.
Once you have created your attachment(s) you simply provide it as the final argument in your report method. Your attachment(s) will be uploaded as part of the report method execution.
await Activity.ReportActionAsync(Verb, Subject, attachment);
Please be mindful that larger attachments may take some time to upload depending on the speed of the end user’s internet connection. The user must keep the app open during this time or the attachment may be lost.