<link media="screen" href="./tizen/tizen.css" type="text/css" rel="stylesheet">
<title>Tizen TV Web Device APIs Reference</title>
- </head>
- <body id="content">
+ <style>
+ table.api-list { width: 90%; margin-left: 2%; }
+ table.api-list tr > td:nth-child(1) { width: 13%; }
+ table.api-list tr > td:nth-child(3) { width: 3em; padding-left: 1em; }
+ table.api-list tr > td:nth-child(4) { width: 5em; }
+ table.api-list tr > td:nth-child(5) { width: 9em; text-align: center; }
+ table.api-list tr > td:nth-child(6) { width: 5em; }
+ table.api-list tr > td:nth-child(7) { width: 9em; text-align: center; }
+ table.api-list tr > td:nth-child(4) .optional { font-style: normal; }
+ table.api-list span.emulated, table.api-list span.partially-emulated { font-weight: bold }
+ /*.emulator-partial { background-color: #ffd0d0; }*/
+ table.api-list .partial-support { font-size: 75%; }
+ table.api-list span.mandatory::after { content: "*"; font-weight: normal; }
+ </style>
+ </head>
+ <body id="content">
<div id="title" class="api">
- <h1>Tizen TV Web Device APIs Reference</h1>
+ <h1>Tizen TV Web Device API Reference</h1>
<div class="brief">
<p>The Tizen Web Device API based on JavaScript provides you advanced access to the device's platform capabilities.</p>
<p>You can develop rich Web applications using the Tizen Web Device API.</p>
<p>The APIs listed in this category are created by the Tizen platform to expose device capabilities to the Web Apps.</p>
<h4 id="Tizen">Base</h4>
- <table width="90%">
+ <table class="api-list">
<thead>
- <tr><th style="width:20%">API</th><th>Description</th><th style="width:5%">Version</th></tr>
+ <tr><th>API</th><th>DESCRIPTION</th><th>VERSION</th><th>STATE</th><th>Supported on<br>TV Emulator</th></tr>
</thead>
<tbody>
<tr>
Archive</a></td>
<td>This API provides interfaces and methods to create an archive file as well as various other kinds of manipulation(e.g. extract files, add a file to an archive file).</td>
<td>2.3</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr>
<tr>
Filesystem</a></td>
<td>This API provides access to the file system of a device. This API might be obsolete in the future when W3C File APIs are extended to access system-sensitive files by Web applications. </td>
<td>1.0</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr>
<tr>
- <td style="width:20%"><a href="tizen/tizen.html" data-origin="tizen" data-domain="system" data-category="core" data-status="S" data-version"">
- Tizen </a></td>
+ <td><a href="tizen/tizen.html" data-origin="tizen" data-domain="system" data-category="core" data-status="S" data-version="">
+ Tizen</a></td>
<td>The base object for accessing the Tizen Web Device API.</td>
<td>1.0</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr>
</tbody>
</table>
<h4 id="Application">Application Framework</h4>
- <table width="90%">
+ <table class="api-list">
<thead>
<tr>
- <th style="width:20%">API</th><th>Description</th><th style="width:5%">Version</th></tr>
+ <th>API</th><th>DESCRIPTION</th><th>VERSION</th><th>STATE</th><th>Supported on<br>TV Emulator</th></tr>
</thead>
<tbody>
<tr>
- <td style="width:20%"><a href="tizen/alarm.html" data-origin="tizen" data-domain="system" data-category="core" data-status="S" data-version="">
+ <td><a href="tizen/alarm.html" data-origin="tizen" data-domain="system" data-category="core" data-status="S" data-version="">
Alarm</a></td>
<td>This API provides functionality for setting and unsetting alarms.</td>
<td>1.0</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr>
<tr><td><a href="tizen/application.html" data-origin="tizen" data-domain="system" data-category="core" data-status="D" data-version="">
Application</a></td>
<td>This API provides information about running and installed applications and controls them.</td>
<td>1.0</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr>
<tr><td><a href="tizen/datacontrol.html" data-origin="tizen" data-domain="system" data-category="core" data-status="D" data-version="">
Data Control</a></td>
<td>This API provides interfaces and methods for accessing specific data exported by other applications.</td>
<td>2.4</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr>
<tr>
<td><a href="tizen/messageport.html" data-origin="tizen" data-domain="filesystem" data-category="core" data-status="D" data-version="">
Message Port</a></td>
<td>This API provides the functionality for communication with other applications. </td>
<td>2.1</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr>
<tr>
<td><a href="tizen/package.html" data-origin="tizen" data-domain="system" data-category="core" data-status="D" data-version="">
Package</a></td>
<td>This API provides information install/uninstall package and get information about installed packages.</td>
<td>2.1</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr>
</tbody>
</table>
<h4 id="Contents">Content</h4>
- <table width="90%">
+ <table class="api-list">
<thead>
<tr>
- <th style="width:20%">API</th><th>Description</th><th style="width:5%">Version</th></tr>
+ <th>API</th><th>DESCRIPTION</th><th>VERSION</th><th>STATE</th><th>Supported on<br>TV Emulator</th></tr>
</thead>
<tbody>
<tr>
Content</a></td>
<td>This API provides functionality to discover multimedia content (such as images, videos or music).</td>
<td>2.0</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr>
<tr>
<td><a href="tizen/download.html" data-origin="tizen" data-domain="content" data-category="core" data-status="D" data-version="">
Download</a></td>
<td>This API provides interfaces and methods for downloading remote objects by HTTP request.</td>
<td>2.0</td>
+ <td>Optional</td>
+ <td>Yes</td>
</tr>
<tr>
<td><a href="tizen/exif.html" data-origin="tizen" data-domain="content" data-category="core" data-status="D" data-version="">
Exif</a></td>
<td>This API provides interfaces and methods for manipulatiing Exif data from JPEG file.</td>
<td>2.3</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr>
</tbody>
</table>
+ <h4 id="Messaging">Messaging</h4>
+ <table class="api-list">
+ <thead>
+ <tr><th>API</th><th>DESCRIPTION</th><th>VERSION</th><th>STATE</th><th>Supported on<br>TV Emulator</th></tr>
+ </thead>
+ <tbody>
+ <tr><td><a href="tizen/push.html">
+ Push</a></td>
+ <td>This API provides the functionality for receiving push notifications.</td>
+ <td>3.0</td>
+ <td>Optional</td>
+ <td>Yes</td>
+
+ </tr></tbody></table>
+
<h4 id="Network">Network</h4>
- <table width="90%">
+ <table class="api-list">
<thead>
<tr>
- <th style="width:20%">API</th><th>Description</th><th style="width:5%">Version</th></tr>
+ <th>API</th><th>DESCRIPTION</th><th>VERSION</th><th>STATE</th><th>Supported on<br>TV Emulator</th></tr>
</thead>
<tbody>
<tr>
<td><a href="tizen/iotcon.html" data-origin="tizen" data-domain="networking" data-category="core" data-status="D" data-version="">
Iotcon</a></td>
- <td>This API provides functions for IoT (Internet of Things) connectivity.</td>
+ <td>This API provides functions for IoT connectivity.</td>
<td>3.0</td>
+ <td>Optional</td>
+ <td>Yes</td>
</tr>
</tbody>
</table>
<h4 id="Security">Security</h4>
- <table width="90%">
+ <table class="api-list">
<thead>
<tr>
- <th style="width:20%">API</th><th>Description</th><th style="width:5%">Version</th></tr>
+ <th>API</th><th>DESCRIPTION</th><th>VERSION</th><th>STATE</th><th>Supported on<br>TV Emulator</th></tr>
</thead>
<tbody>
Key Manager</a></td>
<td>This API provides a secure repository for keys, certificates, and sensitive data of users and/or their applications.</td>
<td>2.4</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr>
<tr><td><a href="tizen/libteec.html" data-origin="tizen" data-domain="pim" data-category="core" data-status="S" data-version="">
LibTeec</a></td>
<td>This API provides interfaces and methods (LibTeec API) for a Trust Zone</td>
<td>4.0</td>
+ <td>Optional</td>
+ <td>Yes</td>
</tr>
</tbody>
</table>
<h4 id="System">System</h4>
- <table width="90%">
+ <table class="api-list">
<thead>
- <tr><th style="width:20%">API</th><th>Description</th><th style="width:5%">Version</th></tr>
+ <tr><th>API</th><th>DESCRIPTION</th><th>VERSION</th><th>STATE</th><th>Supported on<br>TV Emulator</th></tr>
</thead>
<tbody>
<tr><td><a href="tizen/systeminfo.html" data-origin="tizen" data-domain="system" data-category="core" data-status="D" data-version="">
System Information</a></td>
<td>This API provides information about the device's display, network, storage and other capabilities.</td>
<td>1.0</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr>
<tr><td><a href="tizen/time.html" data-origin="tizen" data-domain="system" data-category="core" data-status="S" data-version="">
Time</a></td>
<td>This API exposes information about date, time and time zones.</td>
<td>1.0</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr>
<tr><td><a href="tizen/websetting.html" data-origin="tizen" data-domain="system" data-category="core" data-status="S" data-version="">
Web Setting</a></td>
<td>This API manages the setting states of the web view in web applications.</td>
<td>2.2</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr>
</tbody>
</table>
+ <h4 id="UIX">UIX</h4>
+ <table class="api-list">
+ <thead>
+ <tr><th>API</th><th>DESCRIPTION</th><th>VERSION</th><th>STATE</th><th>Supported on<br>TV Emulator</th></tr>
+ </thead>
+ <tbody>
+ <tr><td><a href="tizen/voicecontrol.html">
+ Voice Control</a></td>
+ <td>This API provides functions for users to set voice commands and to control the web application through their voices.</td>
+ <td>4.0</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
+ </tr></tbody></table>
+
<h4 id="TV Control">TV Controls</h4>
- <table width="90%">
+ <table class="api-list">
<thead>
- <tr><th style="width:20%">API</th><th>Description</th><th style="width:5%">Version</th></tr>
+ <tr><th>API</th><th>DESCRIPTION</th><th>VERSION</th><th>STATE</th><th>Supported on<br>TV Emulator</th></tr>
</thead>
<tbody>
<tr><td><a href="tizen/tvaudiocontrol.html" data-origin="tizen" data-domain="tv" data-category="core" data-status="D" data-version="">
TV Audio Control</a></td>
<td>This API provides interfaces and methods for control of TV audio.</td>
<td>2.3</td>
+ <td>Optional</td>
+ <td>No</td>
</tr>
<tr><td><a href="tizen/tvchannel.html" data-origin="tizen" data-domain="tv" data-category="core" data-status="D" data-version="">
TV Channel</a></td>
<td>This API provides interfaces and methods for control of TV channel, such as getting TV channel list, switching TV channels, and getting information of electronic program guide(EPG).</td>
<td>2.3</td>
+ <td>Optional</td>
+ <td>No</td>
</tr>
<tr><td><a href="tizen/tvdisplaycontrol.html" data-origin="tizen" data-domain="tv" data-category="core" data-status="D" data-version="">
TV Display Control</a></td>
<td>This API provides interfaces and methods for getting information about the effects of stereoscopy(3D mode).</td>
<td>2.3</td>
+ <td>Optional</td>
+ <td>No</td>
</tr>
<tr><td><a href="tizen/tvinputdevice.html" data-origin="tizen" data-domain="system" data-category="core" data-status="S" data-version="2.3">
TV Input Device</a></td>
<td>This API allows receiving key events generated when the user presses a key of an Input Device (for example a TV remote control).</td>
<td>2.3</td>
+ <td>Optional</td>
+ <td>Yes</td>
</tr>
<tr><td><a href="tizen/tvwindow.html" data-origin="tizen" data-domain="tv" data-category="core" data-status="D" data-version="">
TV Window</a></td>
<td>This API provides interfaces and methods for control of TV Window(e.g. main window, PIP window )</td>
<td>2.3</td>
+ <td>Optional</td>
+ <td>No</td>
</tr>
<tr><td><a href="tizen/tvinfo.html" data-origin="tizen" data-domain="tv" data-category="core" data-status="D" data-version="">
TV Information</a></td>
<td>This API provides interfaces and methods for getting information about TV setting.</td>
<td>2.4</td>
+ <td>Optional</td>
+ <td>No</td>
</tr>
</tbody>
</table>
- <h4 id="UIX">UIX</h4>
- <table width="90%">
- <thead>
- <tr><th style="width:20%">API</th><th>Description</th><th style="width:5%">Version</th></tr>
- </thead>
- <tbody>
- <tr><td><a href="tizen/voicecontrol.html">
- Voice Control</a></td>
- <td>This API provides functions for users to set voice commands and to control the web application through their voices.</td>
- <td>4.0</td>
- </tr>
- </tbody>
- </table>
+
<h4 id="Cordova">Cordova</h4>
- <table width="90%">
- <thead>
- <tr><th style="width:20%">API</th><th>Description</th><th style="width:5%">Version</th></tr>
- </thead>
- <tbody>
- <tr><td><a href="tizen/cordova/console.html">
+ <table class="api-list"><thead><tr><th>API</th><th>DESCRIPTION</th><th>VERSION</th><th>STATE</th><th>Supported on<br>TV Emulator</th></tr>
+ </thead><tbody><tr><td><a href="tizen/cordova/console.html">
Console</a></td>
<td>The Console module provides function to access the console.</td>
<td>3.0</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr><tr><td><a href="tizen/cordova/cordova.html">
Cordova</a></td>
<td>This API provides common Cordova functionality.</td>
<td>3.0</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr><tr><td><a href="tizen/cordova/device.html">
Device</a></td>
<td>This plugin defines a global device object, which describes the device's hardware and software.</td>
<td>3.0</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr><tr><td><a href="tizen/cordova/device-motion.html">
Device Motion</a></td>
<td>This plugin provides access to the device's accelerometer.</td>
<td>3.0</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr><tr><td><a href="tizen/cordova/dialogs.html">
Dialogs</a></td>
<td>This plugin provides the ability to make different types of notifications to the user.</td>
<td>3.0</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr><tr><td><a href="tizen/cordova/events.html">
Events</a></td>
<td>This plugin provides information about events defined in cordova.</td>
<td>3.0</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr><tr><td><a href="tizen/cordova/file.html">
File</a></td>
<td>This plugin implements a File API allowing read/write access to files residing on the device.</td>
<td>3.0</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr><tr><td><a href="tizen/cordova/filetransfer.html">
File Transfer</a></td>
<td>This module allows you to upload and download files.</td>
<td>3.0</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr><tr><td><a href="tizen/cordova/globalization.html">
Globalization</a></td>
<td>This plugin obtains information and performs operations specific to the user's locale, language, and timezone.</td>
<td>3.0</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr><tr><td><a href="tizen/cordova/media.html">
Media</a></td>
<td>This plugin provides the ability to record and play back audio files on a device.</td>
<td>3.0</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr><tr><td><a href="tizen/cordova/networkInformation.html">
Network Information</a></td>
<td>This plugin provides information about the device's cellular and wifi connection, and whether the device has an internet connection. </td>
<td>3.0</td>
+ <td>Mandatory</td>
+ <td>Yes</td>
</tr></tbody></table>
--- /dev/null
+<!DOCTYPE html PUBLIC "html">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<link rel="stylesheet" type="text/css" href="tizen.css" media="screen">
+<script type="text/javascript" src="snippet.js"></script><title>Push API</title>
+</head>
+<body id="page-content" onload="prettyPrint()">
+<div class="api" id="::Push">
+<div class="supported-platforms"><img title="Optional" src="../../../images/tv_s_w_optional.png"></div>
+<div class="title"><h1>Push API</h1></div>
+<div class="brief">
+ 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. Connection with push server is used to deliver push notifications to the application, and process the registration and deregistration requests.
+ </div>
+<div class="description">
+ <p>
+To receive push notifications, follow the steps below:
+ </p>
+
+<ul>
+ <li>Connecting to the push service</li>
+ <li>Registering your application, if the application has not been registered yet</li>
+ <li>Getting notification data</li>
+</ul>
+
+<p>For more information on the Push features, see <a href="https://developer.tizen.org/development/guides/web-application/messaging/push-notification">Push Guide</a>.</p>
+
+<p>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> 3.0</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>
+ <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.2. <a href="#PushManager">PushManager</a></li>
+ <li>2.3. <a href="#PushMessage">PushMessage</a></li>
+ <li>2.4. <a href="#PushRegisterSuccessCallback">PushRegisterSuccessCallback</a></li>
+ <li>2.5. <a href="#PushRegistrationStateChangeCallback">PushRegistrationStateChangeCallback</a></li>
+ <li>2.6. <a href="#PushNotificationCallback">PushNotificationCallback</a></li>
+ </ul>
+ </li>
+ <li>3. <a href="#api-features">Related Feature</a></li>
+ <li>4. <a href="#full-webidl">Full WebIDL</a></li>
+</ul>
+
+<h2 id="method-summary">Summary of Interfaces and Methods</h2>
+
+<table class="informaltable">
+ <thead>
+ <tr>
+ <th>Interface</th>
+ <th>Method</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><a href="#PushManagerObject">PushManagerObject</a></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><a href="#PushManager">PushManager</a></td>
+ <td>
+ <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>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::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>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>
+
+ <div><a href="#PushMessage">PushMessage</a>? <a href="#PushManager::getPushMessage">getPushMessage</a> ()</div>
+ </td>
+ </tr>
+ <tr>
+ <td><a href="#PushMessage">PushMessage</a></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><a href="#PushRegisterSuccessCallback">PushRegisterSuccessCallback</a></td>
+ <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>
+ </tbody>
+</table>
+
+<div class="typedefs" id="typedefs-section">
+<h2>1. Type Definitions</h2>
+
+<div class="typedef" id="PushRegistrationId"><a class="backward-compatibility-anchor" name="::Push::PushRegistrationId"></a>
+
+<h3>1.1. PushRegistrationId</h3>
+
+<div class="brief">A push service registration identifier.</div>
+
+<pre class="webidl prettyprint">
+ typedef DOMString PushRegistrationId;</pre>
+
+<p><span class="version">Since: </span> 3.0</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>
+
+<div class="interface" id="PushManagerObject"><a class="backward-compatibility-anchor" name="::Push::PushManagerObject"></a>
+
+<h3>2.1. PushManagerObject</h3>
+
+<div class="brief">The PushManagerObject interface defines what is instantiated by the <em>Tizen </em>object from the Tizen Platform.</div>
+
+<pre class="webidl prettyprint">
+ [NoInterfaceObject] interface PushManagerObject {
+ readonly attribute <a href="#PushManager">PushManager</a> push;
+ };</pre>
+
+<pre class="webidl prettyprint">
+ <a href="tizen.html#Tizen">Tizen</a> implements <a href="#PushManagerObject">PushManagerObject</a>;</pre>
+
+<p><span class="version">Since: </span> 3.0</p>
+
+<div class="description">
+<p>The <em>tizen.push </em>object allows access to the functionality of the Push API.</p>
+</div>
+</div>
+
+<div class="interface" id="PushManager"><a class="backward-compatibility-anchor" name="::Push::PushManager"></a>
+
+<h3>2.2. PushManager</h3>
+
+<div class="brief">The PushManager interface provides methods to manage push registration and notification.</div>
+
+<pre class="webidl prettyprint">
+ [NoInterfaceObject] interface PushManager {
+ void register(<a href="#PushRegisterSuccessCallback">PushRegisterSuccessCallback</a> successCallback, 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>);
+
+ 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 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>);
+
+ <a href="#PushMessage">PushMessage</a>? getPushMessage() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ };</pre>
+
+<p><span class="version">Since: </span> 3.0</p>
+
+<div class="methods">
+<h4>Methods</h4>
+
+<dl>
+ <dt class="method" id=":register"><a class="backward-compatibility-anchor" name="::Push::PushManager::register"></a><code><b><span class="methodName">register</span></b></code></dt>
+ <dd>
+ <div class="brief">Registers an application to the Tizen push server.</div>
+
+ <div class="synopsis">
+ <pre class="signature prettyprint">
+void register(<a href="#PushRegisterSuccessCallback">PushRegisterSuccessCallback</a> successCallback, 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>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</p>
+
+ <p><span class="privilege">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="../../../../org.tizen.guides/html/web/tizen/messaging/push_w.htm">Push Guide</a>.</p>
+
+ <div class="parameters">
+ <p><span class="param">Parameters:</span></p>
+
+ <ul>
+ <li class="param"><span class="name">successCallback</span>: 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 callback to be called when the registration 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 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">
+ <p><span class="example">Code example:</span></p>
+
+ <pre class="examplecode prettyprint" name="code">
+ // Defines the error callback.
+ function errorCallback (response) {
+ console.log("The following error occurred: " + response.name);
+ }
+
+ // Defines the registration success callback
+ function registerSuccessCallback (id) {
+ console.log("Registration succeeded with id: " + id);
+ }
+
+ // 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">
+ <p><span class="title">Output example:</span></p>
+
+ <pre>
+ The state is changed to: UNREGISTERED
+ Registration succeeded with id: 04a150867a50f48cb79695ac732cbe550b4a6782fffd23cbc14ba8dd5c5ab0025dad29a3e4ef5de8849b95b726bea7a6395c
+ The state is changed to: REGISTERED
+ </pre>
+ </div>
+ </dd>
+ <dt class="method" id=":unregister"><a class="backward-compatibility-anchor" name="::Push::PushManager::unregister"></a><code><b><span class="methodName">unregister</span></b></code></dt>
+ <dd>
+ <div class="brief">Unregisters an application from the Tizen push server.</div>
+
+ <div class="synopsis">
+ <pre class="signature prettyprint">
+void unregister(optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, 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>TimeoutError - If the operation timed out.</li>
+ <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">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>: 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>: The callback to be called when the unregistration 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 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">
+ <p><span class="example">Code example:</span></p>
+
+ <pre class="examplecode prettyprint" name="code">
+ // 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);
+ }
+
+ // Defines the unregistration success callback
+ function unregisterSuccessCallback () {
+ console.log("Unregistration succeeded.");
+ }
+
+ // Requests unregistration
+ tizen.push.unregister(unregisterSuccessCallback, errorCallback);
+ </pre>
+ </div>
+
+ <div class="output">
+ <p><span class="title">Output example:</span></p>
+
+ <pre>
+ Unregistration succeeded.
+ </pre>
+ </div>
+ </dd>
+ <dt class="method" id=":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">
+ <p><span class="example">Code example:</span></p>
+
+ <pre class="examplecode prettyprint" name="code">
+ // Defines the state change callback
+ function stateChangeCallback (state) {
+ console.log("The state is changed to: " + state);
+ }
+
+ // Defines the notification callback
+ function notificationCallback (notification) {
+ 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.connect(stateChangeCallback, notificationCallback, errorCallback);
+ </pre>
+ </div>
+
+ <div class="output">
+ <p><span class="title">Output example:</span></p>
+
+ <pre>
+ The state is changed to: UNREGISTERED
+ </pre>
+ </div>
+ </dd>
+ <dt class="method" id=":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">
+ <p><span class="example">Code example:</span></p>
+
+ <pre class="examplecode prettyprint" name="code">
+ // Requests disconnection
+ tizen.push.disconnect();
+ </pre>
+ </div>
+ </dd>
+ <dt class="method" id=":getRegistrationId"><a class="backward-compatibility-anchor" name="::Push::PushManager::getRegistrationId"></a><code><b><span class="methodName">getRegistrationId</span></b></code></dt>
+ <dd>
+ <div class="brief">Gets the push service registration ID for this application if the registration process is successful. <var>null </var>is returned if the application has not been registered yet.</div>
+
+ <div class="synopsis">
+ <pre class="signature prettyprint">
+<a href="#PushRegistrationId">PushRegistrationId</a> getRegistrationId();
+ </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="returntype">
+ <p><span class="return">Return value:</span></p>
+ PushRegistrationId ID assigned by push service.</div>
+
+ <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">
+ <p><span class="example">Code example:</span></p>
+
+ <pre class="examplecode prettyprint" name="code">
+ var registrationId = tizen.push.getRegistrationId();
+ if (registrationId != null) {
+ console.log("The registration id: " + registrationId);
+ }
+ </pre>
+ </div>
+
+ <div class="example">
+ <p><span class="example">Code example:</span></p>
+
+ <pre class="examplecode prettyprint" name="code">
+ // 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">
+ <p><span class="title">Output example:</span></p>
+
+ <pre>
+ The state is changed to: UNREGISTERED
+ The registration ID: 04a150867a50f48cb79695ac732cbe550b4a6782fffd23cbc14ba8dd5c5ab0025dad29a3e4ef5de8849b95b726bea7a6395c
+ </pre>
+ </div>
+ </dd>
+ <dt class="method" id=":getUnreadNotifications"><a class="backward-compatibility-anchor" name="::Push::PushManager::getUnreadNotifications"></a><code><b><span class="methodName">getUnreadNotifications</span></b></code></dt>
+ <dd>
+ <div class="brief">Requests to get unread push notifications. As a consequence, the PushNotificationCallback which was set using the connectService() method will be invoked to retrieve the notifications..</div>
+
+ <div class="synopsis">
+ <pre class="signature prettyprint">
+void getUnreadNotifications();
+ </pre>
+ </div>
+
+ <p><span class="version">Since: </span> 3.0</p>
+
+ <div class="description">
+ <p>The connectService() method must be called to connect to Tizen push server and receive push notifications before calling the getUnreadNotifications() method. If connectService is not called, <var>ServiceNotAvailableError</var> occurs.<br />
+ If any unread message exists, you will get unread push notification message through <var>PushNotificationCallback</var> of connectService(). For instance, if there are 10 unread messages, the <var>PushNotificationCallback</var> will be invoked 10 times.<br />
+ <br />
+ If an application receives unread messages, the messages are removed from the system.</p>
+
+ <p>When an application registers with the push server to receive push notifications, the push server stores messages for the application until they are delivered. While the application is not running, messages cannot be delivered. This method allows retrieving such missed push messages. Once a missed push notification is retrieved the server deletes it from its database.</p>
+ </div>
+
+ <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 ServiceNotAvailableError, if the network is unreachable for some reason(e.g disconnected to the Tizen push server)</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 UnknownError, if any other error occurs.</p>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </div>
+
+ <div class="example">
+ <p><span class="example">Code example:</span></p>
+
+ <pre class="examplecode prettyprint" name="code">
+ // Defines the connect success callback
+ function notificationCallback(message) {
+ console.log("New push message : " + message.alertMessage + ", date : " + message.date + ", data : " + message.appData);
+ }
+ }
+
+ // Requests for push service connection
+ tizen.push.connectService(notificationCallback);
+ tizen.push.getUnreadNotifications();
+ </pre>
+ </div>
+
+ <div class="example">
+ <p><span class="example">Code example:</span></p>
+
+ <pre class="examplecode prettyprint" name="code">
+ // 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">
+ <p><span class="title">Output example:</span></p>
+
+ <pre>
+ The state is changed to: REGISTERED
+ </pre>
+ </div>
+ </dd>
+ <dt class="method" id=":getPushMessage"><a class="backward-compatibility-anchor" name="::Push::PushManager::getPushMessage"></a><code><b><span class="methodName">getPushMessage</span></b></code></dt>
+ <dd>
+ <div class="brief">Gets push messages when the application is launched by the push service.</div>
+
+ <div class="synopsis">
+ <pre class="signature prettyprint">
+<a href="#PushMessage">PushMessage</a>? getPushMessage();
+ </pre>
+ </div>
+
+ <p><span class="version">Since: </span> 3.0</p>
+
+ <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::connect">connect()</a> function.</p>
+
+ <p>If the application was not launched by the push service, this method returns <em>null</em>.</p>
+ </div>
+
+ <p><span class="privilegelevel">Privilege level: </span> public</p>
+
+ <p><span class="privilege">Privilege: </span> http://tizen.org/privilege/push</p>
+
+ <div class="returntype">
+ <p><span class="return">Return value:</span></p>
+ PushMessage The last message delivered from the push service or null.</div>
+
+ <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 AbortError, if the operation cannot be finished properly.</p>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </div>
+
+ <div class="example">
+ <p><span class="example">Code example:</span></p>
+
+ <pre class="examplecode prettyprint" name="code">
+ try {
+ var message = tizen.push.getPushMessage();
+ console.log('Message received from: ' + message.sender);
+ } catch (err) {
+ console.log('Exception - code: ' + err.name + ' message: ' + err.message);
+ }
+ </pre>
+ </div>
+
+ <div class="output">
+ <p><span class="title">Output example:</span></p>
+
+ <pre>
+ Message received from: xyz.AnotherApp
+ </pre>
+ </div>
+ </dd>
+</dl>
+</div>
+</div>
+
+<div class="interface" id="PushMessage"><a class="backward-compatibility-anchor" name="::Push::PushMessage"></a>
+
+<h3>2.3. PushMessage</h3>
+
+<div class="brief">The PushMessage interface specifies the push message that is delivered from the push service.</div>
+
+<pre class="webidl prettyprint">
+ [NoInterfaceObject] interface PushMessage {
+ readonly attribute DOMString appData;
+
+ readonly attribute DOMString alertMessage;
+
+ readonly attribute DOMString message;
+
+ readonly attribute Date date;
+
+ readonly attribute DOMString sender;
+
+ readonly attribute DOMString sessionInfo;
+
+ readonly attribute DOMString requestId;
+ };</pre>
+
+<p><span class="version">Since: </span> 3.0</p>
+
+<div class="attributes">
+<h4>Attributes</h4>
+
+<ul>
+ <li class="attribute" id=":appData"><span class="attrName"><span class="readonly">readonly </span><span class="type">DOMString </span><span class="name">appData</span></span>
+
+ <div class="brief">An attribute to store the push notification data.</div>
+
+ <div class="description">
+ <p>This data is the message that the sender wants to send and its length must be less than 1 KB.</p>
+ </div>
+
+ <p><span class="version">Since: </span> 3.0</p>
+ </li>
+ <li class="attribute" id=":alertMessage"><span class="attrName"><span class="readonly">readonly </span><span class="type">DOMString </span><span class="name">alertMessage</span></span>
+ <div class="brief">An attribute to store the push notification message that may include an alert message to the user.</div>
+
+ <p><span class="version">Since: </span> 3.0</p>
+ </li>
+ <li class="attribute" id=":message"><span class="attrName"><span class="readonly">readonly </span><span class="type">DOMString </span><span class="name">message</span></span>
+ <div class="brief">An attribute to store the full push notification message.</div>
+
+ <p><span class="version">Since: </span> 3.0</p>
+ </li>
+ <li class="attribute" id=":date"><span class="attrName"><span class="readonly">readonly </span><span class="type">Date </span><span class="name">date</span></span>
+ <div class="brief">An attribute to store the date/time when a push notification message is received.</div>
+
+ <p><span class="version">Since: </span> 3.0</p>
+ </li>
+ <li class="attribute" id=":sender"><span class="attrName"><span class="readonly">readonly </span><span class="type">DOMString </span><span class="name">sender</span></span>
+ <div class="brief">The name of the sender of the notification.</div>
+
+ <p><span class="version">Since: </span> 3.0</p>
+ </li>
+ <li class="attribute" id=":sessionInfo"><span class="attrName"><span class="readonly">readonly </span><span class="type">DOMString </span><span class="name">sessionInfo</span></span>
+ <div class="brief">The session information of the notification.</div>
+
+ <p><span class="version">Since: </span> 3.0</p>
+ </li>
+ <li class="attribute" id=":requestId"><span class="attrName"><span class="readonly">readonly </span><span class="type">DOMString </span><span class="name">requestId</span></span>
+ <div class="brief">The request ID assigned by the sender.</div>
+
+ <p><span class="version">Since: </span> 3.0</p>
+
+ <div class="example">
+ <p><span class="example">Code example:</span></p>
+
+ <pre class="examplecode prettyprint" name="code">
+ // Defines the state change callback
+ function stateChangeCallback (state) {
+ console.log("The state is changed to: " + state);
+ }
+
+ // Defines the connect success callback
+ function notificationCallback(noti) {
+ console.log('notification received on ' + noti.date + ' from: ' + noti.sender);
+ console.log('Details:');
+ console.log(' - data: ' + noti.appData);
+ console.log(' - alert message: ' + noti.alertMessage);
+ console.log(' - message: ' + noti.message);
+ console.log(' - session: ' + noti.sessionInfo);
+ console.log(' - request ID: ' + noti.requestId);
+ }
+
+ // Requests for push service connection
+ tizen.push.connect(stateChangeCallback, notificationCallback);
+ </pre>
+ </div>
+
+ <div class="output">
+ <p><span class="title">Output example:</span></p>
+
+ <pre>
+ The state is changed to: REGISTERED
+ notification received on Thu Jan 01 2015 from: xyz.AnotherApp
+ Details:
+ - data: {id:asdf}
+ - alert message: Hi
+ - message: alertMessage=Hi
+ - session: 002002
+ - request ID: 23
+ </pre>
+ </div>
+ </li>
+</ul>
+</div>
+</div>
+
+<div class="interface" id="PushRegisterSuccessCallback"><a class="backward-compatibility-anchor" name="::Push::PushRegisterSuccessCallback"></a>
+
+<h3>2.4. PushRegisterSuccessCallback</h3>
+
+<div class="brief">The PushRegisterSuccessCallback interface specifies the success callback for a push service registration request.</div>
+
+<pre class="webidl prettyprint">
+ [Callback=FunctionOnly, NoInterfaceObject]
+ interface PushRegisterSuccessCallback {
+ void onsuccess(<a href="#PushRegistrationId">PushRegistrationId</a> id);
+ };</pre>
+
+<p><span class="version">Since: </span> 3.0</p>
+
+<div class="description">
+<p>This success callback is invoked when a push service registration request is successful.</p>
+</div>
+
+<div class="methods">
+<h4>Methods</h4>
+
+<dl>
+ <dt class="method" id=":onsuccess"><a class="backward-compatibility-anchor" name="::Push::PushRegisterSuccessCallback::onsuccess"></a><code><b><span class="methodName">onsuccess</span></b></code></dt>
+ <dd>
+ <div class="brief">Called when a push service registration request is successful.</div>
+
+ <div class="synopsis">
+ <pre class="signature prettyprint">
+void onsuccess(<a href="#PushRegistrationId">PushRegistrationId</a> id);
+ </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">id</span>: The registration ID.</li>
+ </ul>
+ </div>
+ </dd>
+</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=":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.6. PushNotificationCallback</h3>
+
+<div class="brief">The PushNotificationCallback interface specifies the notification callback for the received push notification message.</div>
+
+<pre class="webidl prettyprint">
+ [Callback=FunctionOnly, NoInterfaceObject]
+ interface PushNotificationCallback {
+ void onsuccess(<a href="#PushMessage">PushMessage</a> message);
+ };</pre>
+
+<p><span class="version">Since: </span> 3.0</p>
+
+<div class="description">
+<p>This notification callback is invoked when the push notification message arrives.</p>
+</div>
+
+<div class="methods">
+<h4>Methods</h4>
+
+<dl>
+ <dt class="method" id=":onsuccess"><a class="backward-compatibility-anchor" name="::Push::PushNotificationCallback::onsuccess"></a><code><b><span class="methodName">onsuccess</span></b></code></dt>
+ <dd>
+ <div class="brief">Called when the push notification message arrives.</div>
+
+ <div class="synopsis">
+ <pre class="signature prettyprint">
+void onsuccess(<a href="#PushMessage">PushMessage</a> message);
+ </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">message</span>: The received push notification message.</li>
+ </ul>
+ </div>
+ </dd>
+</dl>
+</div>
+</div>
+</div>
+
+<h2 id="api-features">3. Related Feature</h2>
+
+<div class="def-api-features" id="def-api-features">You can check if this API is supported with <em>tizen.systeminfo.getCapability()</em> and decide enable/disable codes that need this API.
+
+<div class="def-api-feature">
+<p> </p>
+
+<div class="description">
+<p>To guarantee that the push application runs on a device with the push feature, declare the following feature requirements in the config file:</p>
+</div>
+
+<p> </p>
+
+<ul>
+ <li class="feature">http://tizen.org/feature/network.push</li>
+</ul>
+</div>
+
+<p> </p>
+For more information, see <a href="../../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">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;
+ };
+ <a href="tizen.html#Tizen">Tizen</a> implements <a href="#PushManagerObject">PushManagerObject</a>;
+
+ [NoInterfaceObject] interface PushManager {
+ void register(<a href="#PushRegisterSuccessCallback">PushRegisterSuccessCallback</a> successCallback, 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>);
+
+ 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 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>);
+
+ <a href="#PushMessage">PushMessage</a>? getPushMessage() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ };
+
+ [NoInterfaceObject] interface PushMessage {
+ readonly attribute DOMString appData;
+
+ readonly attribute DOMString alertMessage;
+
+ readonly attribute DOMString message;
+
+ readonly attribute Date date;
+
+ readonly attribute DOMString sender;
+
+ readonly attribute DOMString sessionInfo;
+
+ readonly attribute DOMString requestId;
+ };
+
+ [Callback=FunctionOnly, NoInterfaceObject]
+ interface PushRegisterSuccessCallback {
+ void onsuccess(<a href="#PushRegistrationId">PushRegistrationId</a> id);
+ };
+
+ [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);
+ };
+
+};</pre>
+</div>
+<div id="page-footer">
+<div class="copyright" align="center">
+ Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>. <br>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.
+ </div>
+<script type="text/javascript">
+
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-25976949-1']);
+ _gaq.push(['_setDomainName', 'tizen.org']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+
+ </script>
+</div>
+</body>
+</html>