Mobile Web

Messaging

Tizen enables you to create applications with messaging functionalities for SMS, MMS, and email.

This feature is supported in mobile applications only.

The messaging process used in HTML5 involves Uniform Resource Identifiers (URIs), which form values of attributes, such as tel, mailto, and sms. These attributes invoke external services which then perform the messaging tasks. The Messaging API minimizes your coding efforts by providing one-step capabilities to perform all high-level messaging-related operations.

The main features of the Messaging API include:

  • Message writing

    You can create a message by using the Message object constructor, and you can set the message attributes and parameters using a MessageInit object (for example, you can set the message service type - SMS, MMS or email - by using the type parameter).

    You can add attachments to your MMS and email messages by creating a MessageAttachment object with the file path and the MIME type (image/png, text/pdf, or text/html) for each object and assigning an array of those objects to the attachments attribute of the Message object.

    To save message drafts for later, use the addDraftMessage() method of the MessageStorage interface.

    Note
    The system assigns a unique read-only message ID to each message the first time it is processed, such as when sending it or creating a draft message for it.
  • Message sending

    You can send messages by using the sendMessage() method of the MessageService interface.

    The method requires both success and error event handlers. Depending on the result of the sending operation, the message is moved to the device's Sent Items folder or Drafts folder, and additionally stored in the message storage database.

  • Message management

    You can find, update, and delete stored messages with methods provided by the MessageStorage interface: findMessages(), updateMessages(), and removeMessages(). The interface allows you to manage message storages.

    When searching for messages, you can create attribute filters, attribute range filters, and composite filters based on specific filter attributes. You can also sort the search results.

  • Message storage change notifications

    You can register event listeners to monitor changes in the message storage, a particular conversation, or a particular message folder.

    The addMessagesChangeListener(), addConversationsChangeListener(), and addFoldersChangeListener() methods of the MessageStorage interface register an event listener, which starts asynchronously once the method returns the subscription identifier for the listener. You can use the MessagesChangeCallback, MessageConversationsChangeCallback, and MessageFoldersChangeCallback interfaces to define listener event handlers for receiving notifications about the changes.

  • Finding folders

    You can find message folders by using the findFolders() method of the MessageStorage interface.

  • Full message content retrieval from the email server

    It is possible that an email message is accessible through the Message object, but its full body or attachment has not been downloaded yet. You can load email messages and attachments from the email service with the loadMessageBody() and loadMessageAttachment() methods of the MessageService interface.

    To keep your email service accounts up-to-date, synchronize them with their respective external servers, such as Gmail and Microsoft Exchange, with the sync() method. You can also synchronize just one folder, such as the Inbox, with the syncFolder() method.

    You can specify the maximum number of messages that can be retrieved in each folder.

  • SMS and dual SIM

    If there are multiple SIM cards in the device, by default the system determines which one is used to send a message. You can also specify the SIM card when sending an SMS.

Go to top