localMessagePortName: Name of the local message port to retrieve
The LocalMessagePort instances are identical for the same message port name.
Return value:
LocalMessagePort LocalMessagePort instance
Exceptions:
WebAPIException
with error type TypeMismatchError, if the input parameter is not compatible with the expected type.
with error type InvalidValuesError, if the input parameter contains an invalid value.
with error type UnknownError, if any other error occurs.
Code example:
// Requests the LocalMessagePort instance with the specified message port name
var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
requestTrustedLocalMessagePort
Requests a trusted LocalMessagePort instance to receive message from another application.
with error type TypeMismatchError, if the input parameter is not compatible with the expected type.
with error type InvalidValuesError, if the input parameter contains an invalid value.
with error type UnknownError, if any other error occurs.
Code example:
// Requests the LocalMessagePort instance with the specified message port name
var localMsgPort = tizen.messageport.requestTrustedLocalMessagePort('MessagePortB');
requestRemoteMessagePort
Requests a RemoteMessagePort instance to send message to another application.
If the message port name and application ID are the same, the platform returns the same RemoteMessagePort instance.
Parameters:
appId: ID of the application to send messages
remoteMessagePortName: Name of remote message port
Return value:
RemoteMessagePort RemoteMessagePort instance
Exceptions:
WebAPIException
with error type NotFoundError, if the port of the target application is not found.
with error type UnknownError, if any other error occurs.
Code example:
// Requests the RemoteMessagePort instance with the specified message port name
var remoteMsgPort = tizen.messageport.requestRemoteMessagePort('6xaeuflskd.App1', 'MessagePortA');
requestTrustedRemoteMessagePort
Requests a trusted RemoteMessagePort instance to receive message from another application.
If the message port name and application ID are the same, the platform returns the same RemoteMessagePort instance. Trusted remote message port can communicate with applications that are signed with same certificate.
Parameters:
appId: ID of the application to send messages
remoteMessagePortName: Name of remote message port
with error type NotFoundError, if the port of the target application is not found.
with error type InvalidAccessError, if the target application is not signed with the same certification.
with error type UnknownError, if any other error occurs
Code example:
// Requests the RemoteMessagePort instance with the specified message port name.
var remoteMsgPort = tizen.messageport.requestTrustedRemoteMessagePort('6xauflskd.App1', 'MessagePortB');
2.3. LocalMessagePort
The LocalMessagePort interface provides methods to receive data.
The flag indicating whether the message port is trusted.
Since: 2.1
Methods
addMessagePortListener
Adds a message port listener to receive messages from other applications.
long addMessagePortListener(MessagePortCallback listener);
Since: 2.1
Parameters:
listener: Callback function that is called when a message is received
Return value:
long ID of the listener that is later used to remove the listener
Exceptions:
WebAPIException
with error type TypeMismatchError, if the input parameter is not compatible with the expected type.
with error type InvalidValuesError, if the input parameter contains an invalid value.
with error type UnknownError, if any other error occurs.
Code example:
function onreceived(data, remoteMsgPort) {
console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
}
var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
var watchId = localMsgPort.addMessagePortListener(onreceived);
removeMessagePortListener
Removes the message port listener.
void removeMessagePortListener(long watchId);
Since: 2.1
Parameters:
watchId: ID to identify the listener
Exceptions:
WebAPIException
with error type TypeMismatchError, if the input parameter is not compatible with the expected type.
with error type InvalidValuesError, if the input parameter contains an invalid value.
with error type NotFoundError, if the watch ID has not been found.
with error type UnknownError, if any other error occurs.
Code example:
var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
var watchId = localMsgPort.addMessagePortListener(onreceived);
// Communication routines of your app...
localMsgPort.removeMessagePortListener(watchId);
2.4. RemoteMessagePort
The RemoteMessagePort interface provides methods to send messages.
The sent messages will be ignored without any notice, unless the target application added one or more listeners to the target local message port.
Parameters:
data: Array of data to send
localMessagePort [optional][nullable]: LocalMessagePort object that gives local message port of the current application
It can be used to receive reply messages from the other end of the message port.
The order of items in this array is not guaranteed to be preserved during data transfer, and values of key within this array must not be duplicated or empty.
Exceptions:
WebAPIException
with error type TypeMismatchError, if the input parameter is not compatible with the expected type.
with error type InvalidValuesError, if an input parameter contains an invalid value.
with error type QuotaExceededError, if the size of message has exceeded the maximum limit.
with error type UnknownError, if any other error occurs.
data: Array of data received from another application
remoteMessagePort [nullable]: RemoteMessagePort port that can be used to reply for the received message
Code example:
// MessagePortCallback instance
function onreceived(data, remoteMsgPort) {
console.log('Received data to \'' + remoteMsgPort.messagePortName + '\'');
}
var localMsgPort = tizen.messageport.requestLocalMessagePort('MessagePortA');
var watchId = localMsgPort.addMessagePortListener(onreceived);
We use cookies to improve your experience on our website and to show you relevant
advertising. Manage you settings for our cookies below.
Essential Cookies
These cookies are essential as they enable you to move around the website. This
category cannot be disabled.
Company
Domain
Samsung Electronics
.samsungdeveloperconference.com
Analytical/Performance Cookies
These cookies collect information about how you use our website. for example which
pages you visit most often. All information these cookies collect is used to improve
how the website works.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Functionality Cookies
These cookies allow our website to remember choices you make (such as your user name, language or the region your are in) and
tailor the website to provide enhanced features and content for you.
Company
Domain
LinkedIn
.ads.linkedin.com, .linkedin.com
Advertising Cookies
These cookies gather information about your browser habits. They remember that
you've visited our website and share this information with other organizations such
as advertisers.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Preferences Submitted
You have successfully updated your cookie preferences.