Immerse SDK
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Attachments

The reporting package allows for media content such as images, audio or video to be attached to statements. One common use case for this is attaching screen captures from the user.

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.

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.

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.