Essential Kit
Loading...
Searching...
No Matches
MessageComposersealed

The MessageComposer class provides a standard interface for composing and sending SMS or MMS messages. More...

Public Member Functions

void SetRecipients (params string[] values)
 Sets the initial recipients of the message..
 
void SetSubject (string value)
 Sets the initial subject of the message.
 
void SetBody (string value)
 Sets the initial content of the message.
 
void AddScreenshot (string fileName)
 Captures a screenshot and adds it as an attachment of the message.
 
void AddImage (Texture2D image, string fileName, TextureEncodingFormat textureEncodingFormat=TextureEncodingFormat.JPG)
 Adds specified image as an attachment of the message.
 
void AddAttachment (byte[] data, string mimeType, string fileName)
 Adds the specified data as an attachment of the message.
 
void SetCompletionCallback (EventCallback< MessageComposerResult > callback)
 Specify the action to execute after the composer is dismissed.
 
void Show ()
 Shows the message composer interface with values initially set.
 

Static Public Member Functions

static MessageComposer CreateInstance ()
 Initializes a new instance of the MessageComposer class.
 
static bool CanSendText ()
 Returns a Boolean value indicating whether the current device is capable of sending text messages.
 
static bool CanSendAttachments ()
 Returns a Boolean value indicating whether or not messages can include attachments.
 
static bool CanSendSubject ()
 Returns a Boolean value indicating whether or not messages can include subject lines.
 

Detailed Description

Before presenting the interface, populate the fields with the set of initial recipients and the message you want to send. After presenting the interface, the user can edit your initial values before sending the message.

The following code example shows how to compose text message.

using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour
{
public void Start()
{
{
// create new instance and populate fields
newComposer.SetBody("Lorem ipsum dolor sit amet");
newComposer.SetCompletionCallback(OnMessageComposerClosed);
newComposer.Show();
}
else
{
// device doesn't support sending emails
}
}
private void OnMessageComposerClosed(MessageComposerResult result, Error error)
{
// add your code
}
}
The MessageComposer class provides a standard interface for composing and sending SMS or MMS messages...
Definition MessageComposer.cs:54
static MessageComposer CreateInstance()
Initializes a new instance of the MessageComposer class.
Definition MessageComposer.cs:68
static bool CanSendText()
Returns a Boolean value indicating whether the current device is capable of sending text messages.
Definition MessageComposer.cs:81
void SetCompletionCallback(EventCallback< MessageComposerResult > callback)
Specify the action to execute after the composer is dismissed.
Definition MessageComposer.cs:314
void Show()
Shows the message composer interface with values initially set.
Definition MessageComposer.cs:326
void SetBody(string value)
Sets the initial content of the message.
Definition MessageComposer.cs:223
This class contains the result of the user action which caused MessageComposer interface to dismiss.
Definition MessageComposerResult.cs:12
Namespace for essential kit features. You need to import this namespace along with VoxelBusters....
Definition AddressBook.cs:8

Member Function Documentation

◆ CanSendText()

static bool CanSendText ( )
static
Returns
true, if the device can send text messages, false otherwise.

◆ CanSendAttachments()

static bool CanSendAttachments ( )
static
Returns
true, if the device can send attachments in MMS or iMessage messages, false otherwise.

Referenced by SharingServices.ShowMessageComposer().

◆ CanSendSubject()

static bool CanSendSubject ( )
static
Returns
true, if the device can include subject lines in messages, false otherwise.

Referenced by SharingServices.ShowMessageComposer().

◆ SetRecipients()

void SetRecipients ( params string[] values)
Parameters
valuesAn array of string values containing the initial recipients of the message.

◆ SetSubject()

void SetSubject ( string value)
Parameters
valueThe initial subject for a message.

◆ SetBody()

void SetBody ( string value)
Parameters
valueThe initial content in the body of a message.

◆ AddScreenshot()

void AddScreenshot ( string fileName)
Parameters
fileNameThe preferred filename to associate with the image.

◆ AddImage()

void AddImage ( Texture2D image,
string fileName,
TextureEncodingFormat textureEncodingFormat = TextureEncodingFormat::JPG )
Parameters
imageThe image that has to be added as an attachment.
fileNameThe preferred filename to associate with the image.
textureEncodingFormatTexture encoding format.

◆ AddAttachment()

void AddAttachment ( byte[] data,
string mimeType,
string fileName )
Parameters
dataThe data of the file that has to be added as an attachment.
mimeTypeThe MIME type of the specified data.
fileNameThe filename of the specified data.

◆ SetCompletionCallback()

void SetCompletionCallback ( EventCallback< MessageComposerResult > callback)
Parameters
callbackThe action to be called on completion.