Show / Hide Table of Contents

    Class MessageComposer

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

    Inheritance
    System.Object
    MessageComposer
    Namespace: VoxelBusters.EssentialKit
    Assembly: cs.temp.dll.dll
    Syntax
    public sealed class MessageComposer : NativeFeatureBehaviour
    Examples

    The following code example shows how to compose text message.

    using UnityEngine;
    using System.Collections;
    using VoxelBusters.EssentialKit;
    
    public class ExampleClass : MonoBehaviour 
    {
        public void Start()
        {
            if (MessageComposer.CanSendText())
            {
                // create new instance and populate fields
                MessageComposer newComposer = MessageComposer.CreateInstance();
                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
        }
    }

    Methods

    AddAttachment(Byte[], String, String)

    Adds the specified data as an attachment of the message.

    Declaration
    public void AddAttachment(byte[] data, string mimeType, string fileName)
    Parameters
    Type Name Description
    System.Byte[] data

    The data of the file that has to be added as an attachment.

    System.String mimeType

    The MIME type of the specified data.

    System.String fileName

    The filename of the specified data.

    AddImage(Texture2D, String, TextureEncodingFormat)

    Adds specified image as an attachment of the message.

    Declaration
    public void AddImage(Texture2D image, string fileName, TextureEncodingFormat textureEncodingFormat = null)
    Parameters
    Type Name Description
    Texture2D image

    The image that has to be added as an attachment.

    System.String fileName

    The preferred filename to associate with the image.

    TextureEncodingFormat textureEncodingFormat

    Texture encoding format.

    AddScreenshot(String)

    Captures a screenshot and adds it as an attachment of the message.

    Declaration
    public void AddScreenshot(string fileName)
    Parameters
    Type Name Description
    System.String fileName

    The preferred filename to associate with the image.

    AwakeInternal(Object[])

    Declaration
    protected override void AwakeInternal(object[] args)
    Parameters
    Type Name Description
    System.Object[] args

    CanSendAttachments()

    Returns a Boolean value indicating whether or not messages can include attachments.

    Declaration
    public static bool CanSendAttachments()
    Returns
    Type Description
    System.Boolean

    true, if the device can send attachments in MMS or iMessage messages, false otherwise.

    CanSendSubject()

    Returns a Boolean value indicating whether or not messages can include subject lines.

    Declaration
    public static bool CanSendSubject()
    Returns
    Type Description
    System.Boolean

    true, if the device can include subject lines in messages, false otherwise.

    CanSendText()

    Returns a Boolean value indicating whether the current device is capable of sending text messages.

    Declaration
    public static bool CanSendText()
    Returns
    Type Description
    System.Boolean

    true, if the device can send text messages, false otherwise.

    CreateInstance()

    Initializes a new instance of the MessageComposer class.

    Declaration
    public static MessageComposer CreateInstance()
    Returns
    Type Description
    MessageComposer

    DestroyInternal()

    Declaration
    protected override void DestroyInternal()

    GetFeatureName()

    Declaration
    protected override string GetFeatureName()
    Returns
    Type Description
    System.String

    IsAvailable()

    Declaration
    public override bool IsAvailable()
    Returns
    Type Description
    System.Boolean

    SetBody(String)

    Sets the initial content of the message.

    Declaration
    public void SetBody(string value)
    Parameters
    Type Name Description
    System.String value

    The initial content in the body of a message.

    SetCompletionCallback(EventCallback<MessageComposerResult>)

    Specify the action to execute after the composer is dismissed.

    Declaration
    public void SetCompletionCallback(EventCallback<MessageComposerResult> callback)
    Parameters
    Type Name Description
    EventCallback<MessageComposerResult> callback

    The action to be called on completion.

    SetRecipients(String[])

    Sets the initial recipients of the message..

    Declaration
    public void SetRecipients(params string[] values)
    Parameters
    Type Name Description
    System.String[] values

    An array of string values containing the initial recipients of the message.

    SetSubject(String)

    Sets the initial subject of the message.

    Declaration
    public void SetSubject(string value)
    Parameters
    Type Name Description
    System.String value

    The initial subject for a message.

    Show()

    Shows the message composer interface with values initially set.

    Declaration
    public void Show()
    Back to top Cross Platform Native Plugins 2.0 : Essential Kit from Voxel Busters