Message Composer
Once after importing the name space, you can share a message with MessageComposer class.
You can set the following to the MessageComposer.
  • Recipients
  • Subject
  • Body
  • Screenshot/Image
  • Attachment (any file)
Before accessing any of the MessageComposer features you need to check if it's allowed to share messages through messaging apps on the user's device.
1
bool canSendText = MessageComposer.CanSendText();
2
bool canSendAttachments = MessageComposer.CanSendAttachments();
3
bool canSendSubject = MessageComposer.CanSendSubject();
Copied!
Once you get the results from above methods, you need to add content to the message composer based on the above status.

Share a screenshot

1
MessageComposer composer = MessageComposer.CreateInstance();
2
composer.SetRecipients(new string[2]{"[email protected]", 9138393x03});
3
composer.SetSubject("Subject");
4
composer.SetBody("Body");
5
composer.AddScreenshot("screenshot file name");
6
composer.SetCompletionCallback((result, error) => {
7
Debug.Log("Message composer was closed. Result code: " + result.ResultCode);
8
});
9
composer.Show();
Copied!

Share a text message

1
MessageComposer composer = MessageComposer.CreateInstance();
2
composer.SetRecipients(new string[2]{"[email protected]", 9138393x03});
3
composer.SetSubject("Subject");
4
composer.SetBody("Body");
5
composer.SetCompletionCallback((result, error) => {
6
Debug.Log("Message composer was closed. Result code: " + result.ResultCode);
7
});
8
composer.Show();
Copied!

Share an image

1
MessageComposer composer = MessageComposer.CreateInstance();
2
composer.SetRecipients(new string[2]{"[email protected]", 9138393x03});
3
composer.AddImage(image, "name");
4
composer.SetCompletionCallback((result, error) => {
5
Debug.Log("Message composer was closed. Result code: " + result.ResultCode);
6
});
7
composer.Show();
Copied!