openMessage( msgId ) method

Launch the server initiated hybrid app associated with a message.

The hybrid app will be opened on top of the hybrid app that is open when hwc.openMessage is called. When the hybrid app that was opened with hwc.openMessage exits, it will exit to the hybrid app that was open when hwc.openMessage was called. It is possible to nest open hybrid apps, but it is best not to have too many nested hybrid apps (eg: recursively opening hybrid apps) because each open hybrid app takes up device memory.

Syntax

<static> openMessage( msgId ) → {number}

Parameters

Name Type Description
msgId number The id of message to open.

Returns

A number indicating the success or failure of opening the message (will be one of hwc.OPEN_MSG_SUCCESS, hwc.OPEN_MSG_NOT_EXIST, hwc.OPEN_MSG_APP_NOT_EXIST, hwc.OPEN_MSG_OTHER).

Type:

number

Example

// get all messages, then open the first one
var messages = hwc.getAllMessages();
if( messages.length > 0 )
{
   hwc.openMessage( messages[0].getMessageId() );
}

Source

hwc-api.js, line 3185.