The Push API provides functionality for receiving push notifications
from the Tizen push server.
The push service is a client daemon that maintains a permanent connection
-between your device and the Tizen push server in order to process your registration
-and deregistration requests and deliver push notifications to applications on a device.
+between your device and the Tizen push server. Connection with push service is used to deliver push notifications
+to the application, and process the registration and deregistration requests.
</div>
<div class="description">
<p>
-If the application is connected, the push service passes the notification data over
-the connection. Otherwise, the push service posts a UI notification with the data.
-It will be delivered when a user launches the application by selecting the posting.
- </p>
- <p>
To receive push notifications, follow the steps below:
</p>
<ul>
<li>
-Get administrative permission for an application on your device </li>
- <li>
-Register the application </li>
+Connecting to the push service </li>
<li>
-Connect to the push service </li>
+Registering your application, if the application has not been registered yet </li>
<li>
-Get notification data </li>
+Getting notification data </li>
</ul>
<p>
-To use Push features, you must <a href="https://developer.tizen.org/development/tutorials/native-application/messaging/push#registration">register to the Push service</a>.
+For more information on the Push features, see <a href="https://developer.tizen.org/development/tutorials/web-application/tizen-features/messaging/push#Registering">Push Guide</a>.
</p>
<p>
-For more information on the Push features, see <a href="https://developer.tizen.org/development/guides/web-application/tizen-features/messaging/push">Push Guide</a>.
+To use Push features the application needs the permission to access the Tizen Push servers.
</p>
+ <p>
+<b>Service Limitation:</b> </p>
+ <ul>
+ <li>
+Size of a push message is limited: <em>alertMessage</em> up to 127 bytes, and <em>appData</em> (payload data) less than 1 KB. </li>
+ <li>
+Push service does not guarantee delivery and order of push messages. </li>
+ </ul>
</div>
<p><span class="version">
Since: </span>
</p>
<h2>Table of Contents</h2>
<ul class="toc">
-<li>1. <a href="#typedefs-section">Type Definitions</a><ul class="toc"><li>1.1. <a href="#PushRegistrationId">PushRegistrationId</a>
-</li></ul>
+<li>1. <a href="#typedefs-section">Type Definitions</a><ul class="toc">
+<li>
+ 1.1. <a href="#PushRegistrationId">PushRegistrationId</a>
+</li>
+<li>
+ 1.2. <a href="#PushRegistrationState">PushRegistrationState</a>
+</li>
+</ul>
</li>
<li>2. <a href="#interfaces-section">Interfaces</a><ul class="toc">
<li>2.1. <a href="#PushManagerObject">PushManagerObject</a>
</li>
<li>2.4. <a href="#PushRegisterSuccessCallback">PushRegisterSuccessCallback</a>
</li>
-<li>2.5. <a href="#PushNotificationCallback">PushNotificationCallback</a>
+<li>2.5. <a href="#PushRegistrationStateChangeCallback">PushRegistrationStateChangeCallback</a>
+</li>
+<li>2.6. <a href="#PushNotificationCallback">PushNotificationCallback</a>
</li>
</ul>
</li>
<div>void <a href="#PushManager::register">register</a> (<a href="#PushRegisterSuccessCallback">PushRegisterSuccessCallback</a> successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
<div class="deprecated">void <a href="#PushManager::unregisterService">unregisterService</a> (optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
<div>void <a href="#PushManager::unregister">unregister</a> (optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
-<div>void <a href="#PushManager::connectService">connectService</a> (<a href="#PushNotificationCallback">PushNotificationCallback</a> notificationCallback)</div>
-<div>void <a href="#PushManager::disconnectService">disconnectService</a> ()</div>
+<div class="deprecated">void <a href="#PushManager::connectService">connectService</a> (<a href="#PushNotificationCallback">PushNotificationCallback</a> notificationCallback)</div>
+<div>void <a href="#PushManager::connect">connect</a> (<a href="#PushRegistrationStateChangeCallback">PushRegistrationStateChangeCallback</a> stateChangeCallback, <a href="#PushNotificationCallback">PushNotificationCallback</a> notificationCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
+<div class="deprecated">void <a href="#PushManager::disconnectService">disconnectService</a> ()</div>
+<div>void <a href="#PushManager::disconnect">disconnect</a> ()</div>
<div>
<a href="#PushRegistrationId">PushRegistrationId</a> <a href="#PushManager::getRegistrationId">getRegistrationId</a> ()</div>
<div>void <a href="#PushManager::getUnreadNotifications">getUnreadNotifications</a> ()</div>
<td><div>void <a href="#PushRegisterSuccessCallback::onsuccess">onsuccess</a> (<a href="#PushRegistrationId">PushRegistrationId</a> id)</div></td>
</tr>
<tr>
+<td><a href="#PushRegistrationStateChangeCallback">PushRegistrationStateChangeCallback</a></td>
+<td><div>void <a href="#PushRegistrationStateChangeCallback::onsuccess">onsuccess</a> (<a href="#PushRegistrationState">PushRegistrationState</a> state)</div></td>
+</tr>
+<tr>
<td><a href="#PushNotificationCallback">PushNotificationCallback</a></td>
<td><div>void <a href="#PushNotificationCallback::onsuccess">onsuccess</a> (<a href="#PushMessage">PushMessage</a> message)</div></td>
</tr>
2.3.1
</p>
</div>
+<div class="enum" id="PushRegistrationState">
+<a class="backward-compatibility-anchor" name="::Push::PushRegistrationState"></a><h3>1.2. PushRegistrationState</h3>
+<div class="brief">
+ A push registration state.
+ </div>
+<pre class="webidl prettyprint"> enum PushRegistrationState {"REGISTERED", "UNREGISTERED"};</pre>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+<div class="description">
+ <ul>
+ <li>
+REGISTERED - The application is registered to the push server. </li>
+ <li>
+UNREGISTERED - The application is not registered to the push server. </li>
+ </ul>
+ </div>
+</div>
</div>
<div class="interfaces" id="interfaces-section">
<h2>2. Interfaces</h2>
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void unregister(optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback,
- optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void connectService(<a href="#PushNotificationCallback">PushNotificationCallback</a> notificationCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ void connect(<a href="#PushRegistrationStateChangeCallback">PushRegistrationStateChangeCallback</a> stateChangeCallback,
+ <a href="#PushNotificationCallback">PushNotificationCallback</a> notificationCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+
void disconnectService() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ void disconnect() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+
<a href="#PushRegistrationId">PushRegistrationId</a> getRegistrationId() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void getUnreadNotifications() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
http://tizen.org/privilege/push
</p>
<p><span class="remark"> Remark : </span>
- In order to use the push messaging service, see the native <a href="https://developer.tizen.org/development/guides/native-application/messaging/push">Push Messaging Guide</a>.
+ In order to use the push messaging service, see <a href="https://developer.tizen.org/development/guides/native-application/messaging/push">Push Guide</a>.
</p>
<div class="parameters">
<p><span class="param">Parameters:</span></p>
/* Defines the error callback */
function errorCallback(response)
{
- console.log('The following error occurred: ' + response.name);
+ console.log('The following error occurred: ' + response.name);
}
/* Defines the registration success callback */
</p>
<ul>
<li>
+TimeoutError - If the operation timed out. </li>
+ <li>
AbortError - If the operation cannot be finished properly. </li>
</ul>
</div>
+<div class="description">
+ <p>
+The <em>connect()</em> method must be called before calling the <em>register()</em> method.
+ </p>
+ </div>
<p><span class="privilegelevel">
Privilege level: </span>
public
Privilege: </span>
http://tizen.org/privilege/push
</p>
+<p><span class="remark"> Remark : </span>
+ In order to use the push messaging service, see <a href="https://developer.tizen.org/development/guides/native-application/messaging/push">Push Guide</a>.
+ </p>
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
<span class="name">successCallback</span>:
- The method to be called when the registration request succeeds.
+ The callback to be called when the registration request succeeds.
</li>
<li class="param">
<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
- The method to be called when the registration request fails.
+ The callback to be called when the registration request fails.
</li>
</ul>
</div>
<li class="list"><p>
with error type SecurityError, if the application does not have the privilege to call this method.
</p></li>
+<li class="list"><p>
+ with error type InvalidStateError, if the application is not connected to the push service.
+ </p></li>
+<li class="list"><p>
+ with error type AbortError, if the operation cannot be finished properly.
+ </p></li>
</ul>
</li></ul>
</div>
/* Defines the error callback */
function errorCallback(response)
{
- console.log("The following error occurred: " + response.name);
+ console.log("The following error occurred: " + response.name);
}
/* Defines the registration success callback */
console.log("Registration succeeded with id: " + id);
}
-/* Requests application registration */
-tizen.push.register(registerSuccessCallback, errorCallback);
+/* Defines the state change callback */
+function stateChangeCallback(state)
+{
+ console.log("The state is changed to: " + state);
+
+ if (state == "UNREGISTERED")
+ {
+ /* Requests application registration */
+ tizen.push.register(registerSuccessCallback, errorCallback);
+ }
+}
+
+/* Defines the notification callback */
+function notificationCallback(notification)
+{
+ console.log("A notification arrives.");
+}
+
+/* Connects to push service */
+tizen.push.connect(stateChangeCallback, notificationCallback, errorCallback);
</pre>
</div>
<div class="output">
-<span class="title"><p>Output example:</p></span><pre> Registration succeeded with id: 04a150867a50f48cb79695ac732cbe550b4a6782fffd23cbc14ba8dd5c5ab0025dad29a3e4ef5de8849b95b726bea7a6395c
+<span class="title"><p>Output example:</p></span><pre> The state is changed to: UNREGISTERED
+ Registration succeeded with id: 04a150867a50f48cb79695ac732cbe550b4a6782fffd23cbc14ba8dd5c5ab0025dad29a3e4ef5de8849b95b726bea7a6395c
+ The state is changed to: REGISTERED
</pre>
</div>
</dd>
/* Defines the error callback */
function errorCallback(response)
{
- console.log('The following error occurred: ' + response.name);
+ console.log('The following error occurred: ' + response.name);
}
/* Defines the unregistration success callback */
</p>
<ul>
<li>
+TimeoutError - If the operation timed out. </li>
+ <li>
AbortError - If the operation cannot be finished properly. </li>
</ul>
</div>
<ul>
<li class="param">
<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
- The method to be called when the unregistration request succeeds.
+ The callback to be called when the unregistration request succeeds.
</li>
<li class="param">
<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
<li class="list"><p>
with error type SecurityError, if the application does not have the privilege to call this method.
</p></li>
+<li class="list"><p>
+ with error type InvalidStateError, if the application is not connected to the push service.
+ </p></li>
+<li class="list"><p>
+ with error type AbortError, if the operation cannot be finished properly.
+ </p></li>
</ul>
</li></ul>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Connection to push service should be established (with connect()) and application should be registered (with register()) before calling the code below */
+
/* Defines the error callback */
function errorCallback(response)
{
- console.log("The following error occurred: " + response.name);
+ console.log("The following error occurred: " + response.name);
}
/* Defines the unregistration success callback */
</pre>
</div>
</dd>
-<dt class="method" id="PushManager::connectService">
+<dt class="deprecated method" id="PushManager::connectService">
<a class="backward-compatibility-anchor" name="::Push::PushManager::connectService"></a><code><b><span class="methodName">connectService</span></b></code>
</dt>
-<dd>
+<dd class="deprecated">
<div class="brief">
Connects to the push service and receives push notifications.
</div>
+<p class="deprecated"><b>Deprecated.</b>
+ This function has been deprecated since 3.0. Use the <a href="push.html#PushManager::connect">connect()</a> function instead.
+ </p>
<div class="synopsis"><pre class="signature prettyprint">void connectService(<a href="#PushNotificationCallback">PushNotificationCallback</a> notificationCallback);
</pre></div>
<p><span class="version">
</p>
<p><span class="remark"> Remark : </span>
If the application calling the <em>connectService()</em> method has not been registered to the Tizen push server,
-the <em>register()</em> method must be called before calling the <em>connectService()</em> method.
+the <em>registerService()</em> method must be called before calling the <em>connectService()</em> method.
</p>
<div class="parameters">
<p><span class="param">Parameters:</span></p>
</div>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
-/* Defines the registration error callback */
+/* Defines the connect success callback */
+function notificationCallback(noti)
+{
+ console.log("Notification received with alert message: " + noti.alertMessage);
+}
+
+/* Defines the data to be used when this process is launched by notification service */
+var service = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/push_test");
+
+/* Defines the error callback */
function errorCallback(response)
{
- console.log("The following error occurred: " + response.name);
+ console.log("The following error occurred: " + response.name);
}
/* Defines the registration success callback */
function registerSuccessCallback(id)
{
console.log("Registration succeeded with id: " + id);
+
+ /* Requests for push service connection */
+ tizen.push.connectService(notificationCallback);
}
-/* Requests application registration */
-tizen.push.register(registerSuccessCallback, errorCallback);
+/* Requests registration */
+tizen.push.registerService(service, registerSuccessCallback, errorCallback);
+</pre>
+</div>
+</dd>
+<dt class="method" id="PushManager::connect">
+<a class="backward-compatibility-anchor" name="::Push::PushManager::connect"></a><code><b><span class="methodName">connect</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Connects to the push service and gets state change events and push notifications.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void connect(<a href="#PushRegistrationStateChangeCallback">PushRegistrationStateChangeCallback</a> stateChangeCallback, <a href="#PushNotificationCallback">PushNotificationCallback</a> notificationCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback);
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+<div class="description">
+ <p>
+The <em>ErrorCallback()</em> is launched with these error types:
+ </p>
+ <ul>
+ <li>
+AbortError - If the operation cannot be finished properly. </li>
+ </ul>
+ </div>
+<p><span class="privilegelevel">
+ Privilege level: </span>
+ public
+ </p>
+<p><span class="privilege">
+ Privilege: </span>
+ http://tizen.org/privilege/push
+ </p>
+<div class="parameters">
+<p><span class="param">Parameters:</span></p>
+<ul>
+ <li class="param">
+<span class="name">stateChangeCallback</span>:
+ The callback to be called when the state of registration is changed. The callback would be called at least once,
+just after connection is established.
+ </li>
+ <li class="param">
+<span class="name">notificationCallback</span>:
+ The callback to be called when the notification message arrives.
+ </li>
+ <li class="param">
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+ The callback to be called when the connect request fails.
+ </li>
+ </ul>
+</div>
+<div class="exceptionlist">
+<p><span class="except">Exceptions:</span></p>
+ <ul class="exception"><li>WebAPIException<ul>
+<li class="list"><p>
+ with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
+ </p></li>
+<li class="list"><p>
+ with error type SecurityError, if the application does not have the privilege to call this method.
+ </p></li>
+<li class="list"><p>
+ with error type AbortError, if the operation cannot be finished properly.
+ </p></li>
+</ul>
+</li></ul>
+ </div>
+<div class="example">
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the state change callback */
+function stateChangeCallback(state)
+{
+ console.log("The state is changed to: " + state);
+}
-/* Defines the connect success callback */
-function notificationCallback(noti)
+/* Defines the notification callback */
+function notificationCallback(notification)
{
- console.log("Notification received with alert message: " + noti.alertMessage);
+ console.log("A notification arrives.");
+}
+
+/* Defines the error callback */
+function errorCallback(error)
+{
+ console.log("The following error occurred: " + error.name);
}
/* Requests for push service connection */
-tizen.push.connectService(notificationCallback);
+tizen.push.connect(stateChangeCallback, notificationCallback, errorCallback);
</pre>
</div>
+<div class="output">
+<span class="title"><p>Output example:</p></span><pre> The state is changed to: UNREGISTERED
+ </pre>
+</div>
</dd>
-<dt class="method" id="PushManager::disconnectService">
+<dt class="deprecated method" id="PushManager::disconnectService">
<a class="backward-compatibility-anchor" name="::Push::PushManager::disconnectService"></a><code><b><span class="methodName">disconnectService</span></b></code>
</dt>
-<dd>
+<dd class="deprecated">
<div class="brief">
Disconnects the push service and stops receiving push notifications.
</div>
+<p class="deprecated"><b>Deprecated.</b>
+ This function has been deprecated since 3.0. Use the <a href="push.html#PushManager::disconnect">disconnect()</a> function instead.
+ </p>
<div class="synopsis"><pre class="signature prettyprint">void disconnectService();
</pre></div>
<p><span class="version">
Since: </span>
- 2.3.1
+ 2.1
</p>
<p><span class="privilegelevel">
Privilege level: </span>
with error type SecurityError, if the application does not have the privilege to call this method.
</p></li>
<li class="list"><p>
- with error type UnknownError, if any other error occurs.
+ with error type AbortError, if the operation cannot be finished properly.
</p></li>
</ul>
</li></ul>
</pre>
</div>
</dd>
+<dt class="method" id="PushManager::disconnect">
+<a class="backward-compatibility-anchor" name="::Push::PushManager::disconnect"></a><code><b><span class="methodName">disconnect</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Disconnects the push service and stops receiving push notifications.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void disconnect();
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+<p><span class="privilegelevel">
+ Privilege level: </span>
+ public
+ </p>
+<p><span class="privilege">
+ Privilege: </span>
+ http://tizen.org/privilege/push
+ </p>
+<div class="exceptionlist">
+<p><span class="except">Exceptions:</span></p>
+ <ul class="exception"><li>WebAPIException<ul>
+<li class="list"><p>
+ with error type SecurityError, if the application does not have the privilege to call this method.
+ </p></li>
+<li class="list"><p>
+ with error type UnknownError, if any other error occurs.
+ </p></li>
+</ul>
+</li></ul>
+ </div>
+<div class="example">
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Requests disconnection */
+tizen.push.disconnect();
+</pre>
+</div>
+</dd>
<dt class="method" id="PushManager::getRegistrationId">
<a class="backward-compatibility-anchor" name="::Push::PushManager::getRegistrationId"></a><code><b><span class="methodName">getRegistrationId</span></b></code>
</dt>
}
</pre>
</div>
+<div class="example">
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the state change callback */
+function stateChangeCallback(state)
+{
+ console.log("The state is changed to: " + state);
+
+ var id = tizen.push.getRegisterationId();
+ console.log("The registration ID: " + id);
+}
+
+/* Defines the notification callback */
+function notificationCallback(notification)
+{
+ console.log("A notification arrives.");
+}
+
+/* Requests for push service connection */
+tizen.push.connect(stateChangeCallback, notificationCallback);
+</pre>
+</div>
+<div class="output">
+<span class="title"><p>Output example:</p></span><pre> The state is changed to: UNREGISTERED
+ The registration ID: 04a150867a50f48cb79695ac732cbe550b4a6782fffd23cbc14ba8dd5c5ab0025dad29a3e4ef5de8849b95b726bea7a6395c
+ </pre>
+</div>
</dd>
<dt class="method" id="PushManager::getUnreadNotifications">
<a class="backward-compatibility-anchor" name="::Push::PushManager::getUnreadNotifications"></a><code><b><span class="methodName">getUnreadNotifications</span></b></code>
tizen.push.getUnreadNotifications();
</pre>
</div>
+<div class="example">
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+/* Defines the state change callback */
+function stateChangeCallback(state)
+{
+ console.log("The state is changed to: " + state);
+
+ if (state === "REGISTERED")
+ {
+ /* Gets unread push notifications */
+ tizen.push.getUnreadNotifications();
+ }
+}
+
+/* Defines the notification callback */
+function notificationCallback(notification)
+{
+ console.log("A notification arrives.");
+}
+
+/* Requests for push service connection */
+tizen.push.connect(stateChangeCallback, notificationCallback);
+</pre>
+</div>
+<div class="output">
+<span class="title"><p>Output example:</p></span><pre> The state is changed to: REGISTERED
+ </pre>
+</div>
</dd>
<dt class="method" id="PushManager::getPushMessage">
<a class="backward-compatibility-anchor" name="::Push::PushManager::getPushMessage"></a><code><b><span class="methodName">getPushMessage</span></b></code>
<div class="description">
<p>
If the application is launched by the push service, the push service is connected when the application is launched.
-Therefore, you can get push messages without calling the <a href="push.html#Push%20Manager::register">register()</a> and
-<a href="push.html#Push%20Manager::connectService">connectService()</a> functions.
+Therefore, you can get push messages without calling the <a href="push.html#Push%20Manager::connect">connect()</a> function.
</p>
<p>
If the application was not launched by the push service, this method returns <em>null</em>.
readonly attribute DOMString sessionInfo;
readonly attribute DOMString requestId;
-
- readonly attribute long type;
};</pre>
<p><span class="version">
Since: </span>
Since: </span>
3.0
</p>
-</li>
-<li class="attribute" id="PushMessage::type">
-<span class="attrName"><span class="readonly"> readonly
-</span><span class="type">long </span><span class="name">type</span></span><div class="brief">
- The type value assigned by the sender.
- </div>
-<p><span class="version">
- Since: </span>
- 3.0
- </p>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
/* Defines the connect success callback */
console.log(' - message: ' + noti.message);
console.log(' - session: ' + noti.sessionInfo);
console.log(' - request ID: ' + noti.requestId);
- console.log(' - type: ' + noti.type);
}
/* Requests for push service connection */
<div class="output">
<span class="title"><p>Output example:</p></span><pre> Notification received on Thu Jan 01 2015 from: xyz.AnotherApp
Details:
- - data: example data
- - alert message: Data from xyz.AnotherApp received
- - session: example session info
+ - data: {id:asdf}
+ - alert message: Hi
+ - message: alertMessage=Hi
+ - session: 002002
- request ID: 23
- - type: 1
</pre>
</div>
</li>
</dl>
</div>
</div>
+<div class="interface" id="PushRegistrationStateChangeCallback">
+<a class="backward-compatibility-anchor" name="::Push::PushRegistrationStateChangeCallback"></a><h3>2.5. PushRegistrationStateChangeCallback</h3>
+<div class="brief">
+ The PushRegistrationStateChangeCallback interface specifies the state change callback for the state change event.
+ </div>
+<pre class="webidl prettyprint"> [Callback=FunctionOnly, NoInterfaceObject]
+ interface PushRegistrationStateChangeCallback {
+ void onsuccess(<a href="#PushRegistrationState">PushRegistrationState</a> state);
+ };</pre>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+<div class="description">
+ <p>
+This state change callback is invoked when the state of registration is changed.
+Moreover PushRegistrationStateChangeCallback would be called at least once, just after connection is established.
+ </p>
+ </div>
+<div class="methods">
+<h4>Methods</h4>
+<dl>
+<dt class="method" id="PushRegistrationStateChangeCallback::onsuccess">
+<a class="backward-compatibility-anchor" name="::Push::PushRegistrationStateChangeCallback::onsuccess"></a><code><b><span class="methodName">onsuccess</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Called when the state of push registration is changed.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void onsuccess(<a href="#PushRegistrationState">PushRegistrationState</a> state);
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+<div class="parameters">
+<p><span class="param">Parameters:</span></p>
+<ul>
+ <li class="param">
+<span class="name">state</span>:
+ The state of push registration.
+ </li>
+ </ul>
+</div>
+</dd>
+</dl>
+</div>
+</div>
<div class="interface" id="PushNotificationCallback">
-<a class="backward-compatibility-anchor" name="::Push::PushNotificationCallback"></a><h3>2.5. PushNotificationCallback</h3>
+<a class="backward-compatibility-anchor" name="::Push::PushNotificationCallback"></a><h3>2.6. PushNotificationCallback</h3>
<div class="brief">
The PushNotificationCallback interface specifies the notification callback for the received push notification message.
</div>
<li class="feature">http://tizen.org/feature/network.push</li>
</div>
<p></p>
- For more information, see <a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/application-filtering">Application Filtering</a>.
+ For more information, see <a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/application-filtering">Application Filtering.</a>
</div>
<h2 id="full-webidl">4. Full WebIDL</h2>
<pre class="webidl prettyprint">module Push {
+
typedef DOMString PushRegistrationId;
+ enum PushRegistrationState {"REGISTERED", "UNREGISTERED"};
+
[NoInterfaceObject] interface PushManagerObject {
readonly attribute <a href="#PushManager">PushManager</a> push;
};
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void unregister(optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback,
- optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void connectService(<a href="#PushNotificationCallback">PushNotificationCallback</a> notificationCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ void connect(<a href="#PushRegistrationStateChangeCallback">PushRegistrationStateChangeCallback</a> stateChangeCallback,
+ <a href="#PushNotificationCallback">PushNotificationCallback</a> notificationCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+
void disconnectService() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ void disconnect() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+
<a href="#PushRegistrationId">PushRegistrationId</a> getRegistrationId() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void getUnreadNotifications() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
readonly attribute DOMString sessionInfo;
readonly attribute DOMString requestId;
-
- readonly attribute long type;
};
[Callback=FunctionOnly, NoInterfaceObject]
};
[Callback=FunctionOnly, NoInterfaceObject]
+ interface PushRegistrationStateChangeCallback {
+ void onsuccess(<a href="#PushRegistrationState">PushRegistrationState</a> state);
+ };
+
+ [Callback=FunctionOnly, NoInterfaceObject]
interface PushNotificationCallback {
void onsuccess(<a href="#PushMessage">PushMessage</a> message);
};