Extension qnx.message

qnx.message

Allow access to device messages (Email, SMS, MMS)

Events

messageservicestatechange

Fired when a message service state has changed.

Event data

{String}

Example
{
     'CONNECTED'
}

messageservicefindresult

Fired when a qnx.message.find operation has returned data.

Event data

{Array} Array of qnx.message.Message objects.

Example
[
{
     handle: 123456,
     type: 'EMAIL',
     folderId: 1,
     sender: 'test@email.com',*
     subject: 'Test email',
     bodyPlainText: 'This is the content of the test email',
     bodyHtml: '<html>...</html>',
     recipients: [{email:'me@email.com', name:'me'}],
     attachments: [{url:'blah.pdf', size:'145678'}]
     ...
},{
     handle: 123457,
     type: 'EMAIL',
     folderId: 1,
     sender: 'test@email.com',*
     subject: 'Test email',
     bodyPlainText: 'This is the content of the test email',
     bodyHtml: '<html>...</html>',
     recipients: [{email:'me@email.com', name:'me'}],
     attachments: [{url:'blah.pdf', size:'145678'}]
     ...
}
]

messageservicefindresult

Fired when a qnx.message.find operation has failed.

Event data

{String} The error message.

messageservicemessageresult

Fired when a qnx.message.getMessage operation has returned data.

Event data

{qnx.message.Message} The qnx.message.Message object.

Example
 {
     handle: 123456,
     type: 'EMAIL',
     folderId: 1,
     sender: 'test@email.com',*
     subject: 'Test email',
     bodyPlainText: 'This is the content of the test email',
     bodyHtml: '<html>...</html>',
     recipients: [{email:'me@email.com', name:'me'},{email:'me2@email.com', name:'me2'}],
     attachments: [{url:'blah.pdf', size:'145678'}]
     ...
} 

messageservicemessagefail

Fired when a qnx.message.getMessage operation has failed.

Event data

{String} The error message.

messageservicenotification

Fired when a message service notification event has occured.

Event data

{Object}

Example
 {
     type:	'NOTIFICATION_NEW_MESSAGE',
     message:
     {
             handle: 123456,
             type: 'EMAIL',
             folderId: 1,
             sender: 'test@email.com',
             subject: 'Test email',
             bodyPlainText: 'This is the content of the test email',
             bodyHtml: '<html>...</html>',
             ...
     }
} 

Members

FIELD_FOLDER_PATH

Defines constant to identify Folder Path field for filtering

FIELD_HANDLE

Defines constant to identify Message Handle field for filtering

FIELD_MESSAGE_TYPE

Defines constant to identify Message Type field for filtering

FIELD_SENDER_EMAIL

Defines constant to identify Sender's Email field for filtering

FIELD_SENDER_NUMBER

Defines constant to identify Sender's Number field for filtering

FilterExpression

The qnx.messages.FilterExpression constructor function. FilterExpression objects can be used to filter the results of the qnx.messages.find() function.

FOLDER_DRAFTS

root DRAFTS folder

FOLDER_INBOX

root INBOX folder

FOLDER_OUTBOX

root OUTBOX folder

FOLDER_SENT

root SENT folder

Message

The message.Message constructor function.

MESSAGE_TYPE_EMAIL

Defines message of EMAIL type

MESSAGE_TYPE_MMS

Defines message of MMS type

MESSAGE_TYPE_SMS_CDMA

Defines message of SMS_CDMA type

MESSAGE_TYPE_SMS_GSM

Defines message of SMS_GSM type

NOTIFICATION_DELIVERY_FAILURE

Notification type for delivery of sent message failed

NOTIFICATION_DELIVERY_SUCCESS

Notification type for delivery of sent message successful

NOTIFICATION_MEMORY_AVAILABLE

Notification type when phone memory is available

NOTIFICATION_MEMORY_FULL

Notification type when phone memory is full

NOTIFICATION_MESSAGE_DELETED

Notification type when message is deleted

NOTIFICATION_MESSAGE_SHIFT

Notification type when message moved

NOTIFICATION_NEW_MESSAGE

Notification type for new messages

NOTIFICATION_SENDING_FAILURE

Notification type for sending of message failed

NOTIFICATION_SENDING_SUCCESS

Notification type for sending of message successful

STATE_CONNECTED

Service Connected and ready to accept commands

STATE_DISCONNECTED

Service Disconnected

STATE_INITIALIZING

Service Initializing

Methods

find

Return an array of zero or more messages
Parameters:
Name Type Description
filter qnxcar.phonebook.filterExpression [optional] The qnxcar.phonebook.filterExpression filter expression to apply against the phone book database.
orderBy String [optional] The field name to order by. The default order is descending, however this can be overridden by specifying the isAscending parameter as 'true'. Defaults to 'last_name'.
isAscending Boolean [optional] If an orderBy parameter is supplied, changes the order direction to ascending if true, descending if false. Defaults to false.
limit Number [optional] The maximum number of Contacts to return. Defaults to -1 (no limit).
offset Number [optional] Specifies the record offset. Defaults to 0 (no offset).

getAccounts

Return a list of message accounts
Parameters:
Name Type Description
messageType {String} [optional] Filter returned accounts by supported message type.
Returns:
The list of message accounts.
Type
  • Array
Example
[
     {
          id: 0,
          name: 'Desktop_1',
          messageTypes: ['EMAIL']
     },
     {
          id: 1,
          name: 'SMSMMS_0',
          messageTypes: ['SMS_GSM', 'MMS']
     }
]

getFolders

Get a list of folders by type.
Parameters:
Name Type Description
accountId Number The message account ID.
parentFolderId Number [optional] The parent folder ID. If not specified, the entire folder tree is returned.

getMessage

Retrieve message from the database; check first to see if message exists in database and then return it, if not initiated PPS request to fetch message by provided message handle. The message is returned asynchronously, and can be retrieved by listening to the messageservicemessageresult event. Returns a fully populated message, including full subject, contents, recipient list, and attachments.
Parameters:
Name Type Description
accountId Number The ID of the account for which the message exists
handle String Unique identifier of the message of certain type

getState

Return current state of the MAP
Returns:
Value which will indicate current state of the service, STATE_CONNECTED, STATE_DISCONNECTED, STATE_INITIALIZING
Type
  • String

move

Move this message to different folder
Parameters:
Name Type Description
folder Number The folder ID to which the message will be moved.

remove

Remove this message from the device MAP storage

save

Save this message to the device MAP storage

send

Send this message

Message

Message object constructor.
Parameters:
Name Type Description
properties Object The properties argument can be used to initialize the Messages's properties.