[Alarm] Changed behaviour of getAlarmNotification 61/146761/6
authorPiotr Kosko <p.kosko@samsung.com>
Wed, 30 Aug 2017 09:14:45 +0000 (11:14 +0200)
committerPiotr Kosko <p.kosko@samsung.com>
Mon, 4 Sep 2017 12:10:44 +0000 (14:10 +0200)
PS3: Studio content reviewed.
PS4: Removed extra whitespace

Change-Id: I1e856333035b2c906a49ca04b2afd323134a6153
Signed-off-by: Piotr Kosko <p.kosko@samsung.com>
org.tizen.guides/html/web/alarm/alarms_w.htm
org.tizen.web.apireference/html/device_api/mobile/tizen/alarm.html
org.tizen.web.apireference/html/device_api/wearable/tizen/alarm.html

index 30fb656..6b37a57 100644 (file)
@@ -189,14 +189,14 @@ console.log('The alarm triggers ' + alarm.getRemainingSeconds() + ' seconds late
 <h2 id="notification" name="notification">Managing Alarm Notifications in Mobile and Wearable Applications</h2>
 <p>Alarm notification is an alarm which, when triggered, automatically posts a <a href="../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/notification.html#Notification">notification</a>. You can create alarm notifications with both <code>AlarmAbsolute</code> (in <a href="../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/alarm.html#AlarmAbsolute">mobile</a> and <a href="../../../../org.tizen.web.apireference/html/device_api/wearable/tizen/alarm.html#AlarmAbsolute">wearable</a> applications) and <code>AlarmRelative</code> (in <a href="../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/alarm.html#AlarmRelative">mobile</a> and <a href="../../../../org.tizen.web.apireference/html/device_api/wearable/tizen/alarm.html#AlarmRelative">wearable</a> applications) alarm types. The notification is shown in the status bar on the device.</p>
 
-<p>To create an alarm notification with the <code>AlarmRelative</code> alarm type and <code>StatusNotification</code> notification type, where the alarm is periodic and the notification is posted after the alarm is triggered:</p>
+<p>To create an alarm notification with the <code>AlarmRelative</code> alarm type and <code>UserNotification</code> notification type, where the alarm is periodic and the notification is posted after the alarm is triggered:</p>
 <ol>
    <li><p>Create an <code>AlarmRelative</code> object:</p>
 <pre class="prettyprint">
 /* Alarm triggers after 3 seconds and repeats every 3 hours */
 var alarm = new tizen.AlarmRelative(3, 3 * tizen.alarm.PERIOD_HOUR);
 </pre></li>
-   <li><p>Create the <code>ApplicationControl</code> and <code>StatusNotificationInit</code> instances needed for the <code>StatusNotification</code> notification type:</p>
+   <li><p>Create the <code>ApplicationControl</code> and <code>UserNotificationInit</code> instances needed for the <code>UserNotification</code> notification type:</p>
 <pre class="prettyprint">
 /* Create ApplicationControl object */
 var appControl = new tizen.ApplicationControl('http://tizen.org/appcontrol/operation/default',
@@ -204,13 +204,15 @@ var appControl = new tizen.ApplicationControl('http://tizen.org/appcontrol/opera
 /* You can add additional attibutes to the notification dictionary */
 var notificationDict = {
     content: 'This is a simple notification\'s content.',
-    vibration: true,
-    appId: tizen.application.getCurrentApplication().appInfo.id,
-    appControl: appControl,
+    actions: {
+        vibration: true,
+        appId: tizen.application.getCurrentApplication().appInfo.id,
+        appControl: appControl
+    },
 };
-/* Create StatusNotification object */
-var notification = new tizen.StatusNotification('SIMPLE', 'Simple notification\'s title',
-                                                notificationDict);
+/* Create UserNotification object */
+var notification = new tizen.UserNotification('SIMPLE', 'Simple notification\'s title',
+                                              notificationDict);
 </pre></li>
    <li><p>Add the alarm notification:</p>
 <pre class="prettyprint">
@@ -248,4 +250,4 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga
 </script>
 
 </body>
-</html>
\ No newline at end of file
+</html>
index 83254fb..a6f8ffd 100755 (executable)
@@ -67,13 +67,18 @@ For more information on the Alarm features, see <a href="https://developer.tizen
 </tr>
 <tr>
 <td><a href="#AlarmManager">AlarmManager</a></td>
-<td>void <a href="#AlarmManager::add">add</a> (<a href="#Alarm">Alarm</a> alarm, <a href="application.html#ApplicationId">ApplicationId</a> applicationId, optional <a href="application.html#ApplicationControl">ApplicationControl</a>? appControl)<br>
-    void <a href="#AlarmManager::addAlarmNotification">addAlarmNotification</a> (<a href="#Alarm">Alarm</a> alarm, <a href="notification.html#Notification">Notification</a> notification)<br>
-    void <a href="#AlarmManager::remove">remove</a> (<a href="#AlarmId">AlarmId</a> id)<br>
-    void <a href="#AlarmManager::removeAll">removeAll</a> ()<br>
-    <a href="#Alarm">Alarm</a> <a href="#AlarmManager::get">get</a> (<a href="#AlarmId">AlarmId</a> id)<br>
-    <a href="notification.html#Notification">Notification</a> <a href="#AlarmManager::getAlarmNotification">getAlarmNotification</a> (<a href="#AlarmId">AlarmId</a> id)<br>
-    <a href="#Alarm">Alarm</a>[] <a href="#AlarmManager::getAll">getAll</a> ()</td>
+<td>
+<div>void <a href="#AlarmManager::add">add</a> (<a href="#Alarm">Alarm</a> alarm, <a href="application.html#ApplicationId">ApplicationId</a> applicationId, optional <a href="application.html#ApplicationControl">ApplicationControl</a>? appControl)</div>
+<div>void <a href="#AlarmManager::addAlarmNotification">addAlarmNotification</a> (<a href="#Alarm">Alarm</a> alarm, <a href="notification.html#Notification">Notification</a> notification)</div>
+<div>void <a href="#AlarmManager::remove">remove</a> (<a href="#AlarmId">AlarmId</a> id)</div>
+<div>void <a href="#AlarmManager::removeAll">removeAll</a> ()</div>
+<div>
+<a href="#Alarm">Alarm</a> <a href="#AlarmManager::get">get</a> (<a href="#AlarmId">AlarmId</a> id)</div>
+<div>
+<a href="notification.html#UserNotification">UserNotification</a> <a href="#AlarmManager::getAlarmNotification">getAlarmNotification</a> (<a href="#AlarmId">AlarmId</a> id)</div>
+<div>
+<a href="#Alarm">Alarm</a>[] <a href="#AlarmManager::getAll">getAll</a> ()</div>
+</td>
 </tr>
 <tr>
 <td><a href="#Alarm">Alarm</a></td>
@@ -81,11 +86,11 @@ For more information on the Alarm features, see <a href="https://developer.tizen
 </tr>
 <tr>
 <td><a href="#AlarmRelative">AlarmRelative</a></td>
-<td>long? <a href="#AlarmRelative::getRemainingSeconds">getRemainingSeconds</a> ()</td>
+<td><div>long? <a href="#AlarmRelative::getRemainingSeconds">getRemainingSeconds</a> ()</div></td>
 </tr>
 <tr>
 <td><a href="#AlarmAbsolute">AlarmAbsolute</a></td>
-<td>Date? <a href="#AlarmAbsolute::getNextScheduledDate">getNextScheduledDate</a> ()</td>
+<td><div>Date? <a href="#AlarmAbsolute::getNextScheduledDate">getNextScheduledDate</a> ()</div></td>
 </tr>
 </tbody>
 </table>
@@ -160,7 +165,7 @@ The <em>tizen.alarm </em>object allows access to the functionality of the Alarm
 
         <a href="#Alarm">Alarm</a> get(<a href="#AlarmId">AlarmId</a> id) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
 
-        <a href="notification.html#Notification">Notification</a> getAlarmNotification(<a href="#AlarmId">AlarmId</a> id) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+        <a href="notification.html#UserNotification">UserNotification</a> getAlarmNotification(<a href="#AlarmId">AlarmId</a> id) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
 
         <a href="#Alarm">Alarm</a>[] getAll() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
     };</pre>
@@ -362,13 +367,17 @@ For more information about the notification, see <a href="notification.html">The
 <span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
 /* Triggers an alarm notification on a given date/time */
 var alarm = new tizen.AlarmAbsolute(new Date(2017, 10, 4, 8, 0));
-var notificationDict =
+var notificationGroupDict =
 {
-   content: "This is a simple notification.",
-   iconPath: "images/image1.jpg",
-   soundPath: "music/Over the horizon.mp3"
+  content: "This is a simple user notification.",
+  actions:
+  {
+    soundPath: "music/Over the horizon.mp3",
+    vibration: true
+  }
 };
-var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
+
+var notification = new tizen.UserNotification("SIMPLE", "User notification", notificationGroupDict);
 
 tizen.alarm.addAlarmNotification(alarm, notification);
 console.log("Alarm notification added with id: " + alarm.id);
@@ -559,9 +568,9 @@ console.log("The alarm will trigger at " + alarm.getNextScheduledDate());
 </dt>
 <dd>
 <div class="brief">
- Gets the notification to be posted when an alarm is triggered. Returned <em>Notification</em> is exactly the same like passed to method <em>addAlarmNotification</em>.
+ Gets the notification to be posted when an alarm is triggered. Returned <em>UserNotification</em> contains exactly the same data like passed to method <em>addAlarmNotification</em>.
             </div>
-<div class="synopsis"><pre class="signature prettyprint"><a href="notification.html#Notification">Notification</a> getAlarmNotification(<a href="#AlarmId">AlarmId</a> id);
+<div class="synopsis"><pre class="signature prettyprint"><a href="notification.html#UserNotification">UserNotification</a> getAlarmNotification(<a href="#AlarmId">AlarmId</a> id);
              </pre></div>
 <p><span class="version">
             Since: </span>
@@ -575,6 +584,10 @@ console.log("The alarm will trigger at " + alarm.getNextScheduledDate());
             Privilege: </span>
  http://tizen.org/privilege/alarm
             </p>
+<p><span class="remark"> Remark : </span>
+ This method is designed to return only <a href="notification.html#UserNotification">UserNotification</a> objects,
+even if the added alarm was using <a href="notification.html#StatusNotification">StatusNofitication</a>.
+            </p>
 <div class="parameters">
 <p><span class="param">Parameters:</span></p>
 <ul>
@@ -609,24 +622,28 @@ var date = new Date();
 date.setHours(date.getHours() + 1);
 var alarm = new tizen.AlarmAbsolute(date);
 
-var notificationDict =
+var notificationGroupDict =
 {
-   content: "This is a simple notification.",
-   iconPath: "images/image1.jpg",
-   soundPath: "music/Over the horizon.mp3"
+  content: "This is a simple user notification.",
+  actions:
+  {
+    soundPath: "music/Over the horizon.mp3",
+    vibration: true
+  }
 };
-var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
+
+var notification = new tizen.UserNotification("SIMPLE", "User notification", notificationGroupDict);
 
 /* Adds an alarm */
 tizen.alarm.addAlarmNotification(alarm, notification);
 
 /* Gets a notification */
 var notification = tizen.alarm.getAlarmNotification(alarm.id);
-console.log("Notification title: " + notification.title + ", content: " + notification.content);
+console.log("User Notification title: " + notification.title + ", content: " + notification.content);
 </pre>
 </div>
 <div class="output">
-<span class="title"><p>Output example:</p></span><pre> Notification title: Simple notification, content: This is a simple notification.
+<span class="title"><p>Output example:</p></span><pre> User Notification title: User notification, content: This is a simple user notification.
  </pre>
 </div>
 </dd>
@@ -837,8 +854,6 @@ console.log("remaining time is " + sec);
     interface AlarmAbsolute : <a href="#Alarm">Alarm</a> {
         readonly attribute Date date;
 
-        readonly attribute long? period;
-
         readonly attribute <a href="#ByDayValue">ByDayValue</a>[] daysOfTheWeek;
 
         Date? getNextScheduledDate() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
@@ -1047,8 +1062,6 @@ console.log("next scheduled time is " + date);
     interface AlarmAbsolute : <a href="#Alarm">Alarm</a> {
         readonly attribute Date date;
 
-        readonly attribute long? period;
-
         readonly attribute <a href="#ByDayValue">ByDayValue</a>[] daysOfTheWeek;
 
         Date? getNextScheduledDate() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
index f9fe271..406ba68 100755 (executable)
@@ -67,13 +67,18 @@ For more information on the Alarm features, see <a href="https://developer.tizen
 </tr>
 <tr>
 <td><a href="#AlarmManager">AlarmManager</a></td>
-<td>void <a href="#AlarmManager::add">add</a> (<a href="#Alarm">Alarm</a> alarm, <a href="application.html#ApplicationId">ApplicationId</a> applicationId, optional <a href="application.html#ApplicationControl">ApplicationControl</a>? appControl)<br>
-    void <a href="#AlarmManager::addAlarmNotification">addAlarmNotification</a> (<a href="#Alarm">Alarm</a> alarm, <a href="notification.html#Notification">Notification</a> notification)<br>
-    void <a href="#AlarmManager::remove">remove</a> (<a href="#AlarmId">AlarmId</a> id)<br>
-    void <a href="#AlarmManager::removeAll">removeAll</a> ()<br>
-    <a href="#Alarm">Alarm</a> <a href="#AlarmManager::get">get</a> (<a href="#AlarmId">AlarmId</a> id)<br>
-    <a href="notification.html#Notification">Notification</a> <a href="#AlarmManager::getAlarmNotification">getAlarmNotification</a> (<a href="#AlarmId">AlarmId</a> id)<br>
-    <a href="#Alarm">Alarm</a>[] <a href="#AlarmManager::getAll">getAll</a> ()</td>
+<td>
+<div>void <a href="#AlarmManager::add">add</a> (<a href="#Alarm">Alarm</a> alarm, <a href="application.html#ApplicationId">ApplicationId</a> applicationId, optional <a href="application.html#ApplicationControl">ApplicationControl</a>? appControl)</div>
+<div>void <a href="#AlarmManager::addAlarmNotification">addAlarmNotification</a> (<a href="#Alarm">Alarm</a> alarm, <a href="notification.html#Notification">Notification</a> notification)</div>
+<div>void <a href="#AlarmManager::remove">remove</a> (<a href="#AlarmId">AlarmId</a> id)</div>
+<div>void <a href="#AlarmManager::removeAll">removeAll</a> ()</div>
+<div>
+<a href="#Alarm">Alarm</a> <a href="#AlarmManager::get">get</a> (<a href="#AlarmId">AlarmId</a> id)</div>
+<div>
+<a href="notification.html#UserNotification">UserNotification</a> <a href="#AlarmManager::getAlarmNotification">getAlarmNotification</a> (<a href="#AlarmId">AlarmId</a> id)</div>
+<div>
+<a href="#Alarm">Alarm</a>[] <a href="#AlarmManager::getAll">getAll</a> ()</div>
+</td>
 </tr>
 <tr>
 <td><a href="#Alarm">Alarm</a></td>
@@ -81,11 +86,11 @@ For more information on the Alarm features, see <a href="https://developer.tizen
 </tr>
 <tr>
 <td><a href="#AlarmRelative">AlarmRelative</a></td>
-<td>long? <a href="#AlarmRelative::getRemainingSeconds">getRemainingSeconds</a> ()</td>
+<td><div>long? <a href="#AlarmRelative::getRemainingSeconds">getRemainingSeconds</a> ()</div></td>
 </tr>
 <tr>
 <td><a href="#AlarmAbsolute">AlarmAbsolute</a></td>
-<td>Date? <a href="#AlarmAbsolute::getNextScheduledDate">getNextScheduledDate</a> ()</td>
+<td><div>Date? <a href="#AlarmAbsolute::getNextScheduledDate">getNextScheduledDate</a> ()</div></td>
 </tr>
 </tbody>
 </table>
@@ -160,7 +165,7 @@ The <em>tizen.alarm </em>object allows access to the functionality of the Alarm
 
         <a href="#Alarm">Alarm</a> get(<a href="#AlarmId">AlarmId</a> id) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
 
-        <a href="notification.html#Notification">Notification</a> getAlarmNotification(<a href="#AlarmId">AlarmId</a> id) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+        <a href="notification.html#UserNotification">UserNotification</a> getAlarmNotification(<a href="#AlarmId">AlarmId</a> id) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
 
         <a href="#Alarm">Alarm</a>[] getAll() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
     };</pre>
@@ -362,13 +367,17 @@ For more information about the notification, see <a href="notification.html">The
 <span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
 /* Triggers an alarm notification on a given date/time */
 var alarm = new tizen.AlarmAbsolute(new Date(2017, 10, 4, 8, 0));
-var notificationDict =
+var notificationGroupDict =
 {
-   content: "This is a simple notification.",
-   iconPath: "images/image1.jpg",
-   soundPath: "music/Over the horizon.mp3"
+  content: "This is a simple user notification.",
+  actions:
+  {
+    soundPath: "music/Over the horizon.mp3",
+    vibration: true
+  }
 };
-var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
+
+var notification = new tizen.UserNotification("SIMPLE", "User notification", notificationGroupDict);
 
 tizen.alarm.addAlarmNotification(alarm, notification);
 console.log("Alarm notification added with id: " + alarm.id);
@@ -559,9 +568,9 @@ console.log("The alarm will trigger at " + alarm.getNextScheduledDate());
 </dt>
 <dd>
 <div class="brief">
- Gets the notification to be posted when an alarm is triggered. Returned <em>Notification</em> is exactly the same like passed to method <em>addAlarmNotification</em>.
+ Gets the notification to be posted when an alarm is triggered. Returned <em>UserNotification</em> contains exactly the same data like passed to method <em>addAlarmNotification</em>.
             </div>
-<div class="synopsis"><pre class="signature prettyprint"><a href="notification.html#Notification">Notification</a> getAlarmNotification(<a href="#AlarmId">AlarmId</a> id);
+<div class="synopsis"><pre class="signature prettyprint"><a href="notification.html#UserNotification">UserNotification</a> getAlarmNotification(<a href="#AlarmId">AlarmId</a> id);
              </pre></div>
 <p><span class="version">
             Since: </span>
@@ -575,6 +584,10 @@ console.log("The alarm will trigger at " + alarm.getNextScheduledDate());
             Privilege: </span>
  http://tizen.org/privilege/alarm
             </p>
+<p><span class="remark"> Remark : </span>
+ This method is designed to return only <a href="notification.html#UserNotification">UserNotification</a> objects,
+even if the added alarm was using <a href="notification.html#StatusNotification">StatusNofitication</a>.
+            </p>
 <div class="parameters">
 <p><span class="param">Parameters:</span></p>
 <ul>
@@ -609,24 +622,28 @@ var date = new Date();
 date.setHours(date.getHours() + 1);
 var alarm = new tizen.AlarmAbsolute(date);
 
-var notificationDict =
+var notificationGroupDict =
 {
-   content: "This is a simple notification.",
-   iconPath: "images/image1.jpg",
-   soundPath: "music/Over the horizon.mp3"
+  content: "This is a simple user notification.",
+  actions:
+  {
+    soundPath: "music/Over the horizon.mp3",
+    vibration: true
+  }
 };
-var notification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
+
+var notification = new tizen.UserNotification("SIMPLE", "User notification", notificationGroupDict);
 
 /* Adds an alarm */
 tizen.alarm.addAlarmNotification(alarm, notification);
 
 /* Gets a notification */
 var notification = tizen.alarm.getAlarmNotification(alarm.id);
-console.log("Notification title: " + notification.title + ", content: " + notification.content);
+console.log("User Notification title: " + notification.title + ", content: " + notification.content);
 </pre>
 </div>
 <div class="output">
-<span class="title"><p>Output example:</p></span><pre> Notification title: Simple notification, content: This is a simple notification.
+<span class="title"><p>Output example:</p></span><pre> User Notification title: User notification, content: This is a simple user notification.
  </pre>
 </div>
 </dd>
@@ -837,8 +854,6 @@ console.log("remaining time is " + sec);
     interface AlarmAbsolute : <a href="#Alarm">Alarm</a> {
         readonly attribute Date date;
 
-        readonly attribute long? period;
-
         readonly attribute <a href="#ByDayValue">ByDayValue</a>[] daysOfTheWeek;
 
         Date? getNextScheduledDate() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
@@ -1047,8 +1062,6 @@ console.log("next scheduled time is " + date);
     interface AlarmAbsolute : <a href="#Alarm">Alarm</a> {
         readonly attribute Date date;
 
-        readonly attribute long? period;
-
         readonly attribute <a href="#ByDayValue">ByDayValue</a>[] daysOfTheWeek;
 
         Date? getNextScheduledDate() raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);