Updates the summary for notification_set_text
[platform/core/api/notification.git] / include / notification.h
1 /*
2  * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 #ifndef __NOTIFICATION_H__
19 #define __NOTIFICATION_H__
20
21
22 #include <time.h>
23 #include <bundle.h>
24 #include <app_control.h>
25
26
27 #include <notification_error.h>
28 #include <notification_type.h>
29 #include <notification_status.h>
30
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36
37 /**
38  * @file notification.h
39  * @brief This file contains the notification API.
40  */
41
42
43 /**
44  * @addtogroup NOTIFICATION_MODULE
45  * @{
46  */
47
48
49 /**
50  * @brief Sets an absolute path for an image file to display on the notification view.
51  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
52  * @param[in] noti The notification handle
53  * @param[in] type The notification image type
54  * @param[in] image_path The image file full path
55  * @return #NOTIFICATION_ERROR_NONE on success,
56  *         otherwise any other value on failure
57  * @retval #NOTIFICATION_ERROR_NONE Success
58  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
59  * @pre Notification handle should be created by notification_create().
60  * @see #notification_image_type_e
61  * @see notification_create()
62  * @par Sample code:
63  * @code
64 #include <notification.h>
65
66 {
67         notification_h noti = NULL;
68         int noti_err = NOTIFICATION_ERROR_NONE;
69
70         noti = notification_create(NOTIFICATION_TYPE_NOTI);
71         if (noti == NULL)
72                 return;
73
74         noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, APP_IMAGE_FULL_PATH);
75         if (noti_err != NOTIFICATION_ERROR_NONE) {
76                 notification_free(noti);
77                 return;
78         }
79 }
80  * @endcode
81  */
82 int notification_set_image(notification_h noti, notification_image_type_e type, const char *image_path);
83
84
85 /**
86  * @brief Gets the absolute path of an image file.
87  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
88  * @remarks Do not free @a image_path. It will be freed when notification_free() is called.
89  * @param[in] noti Notification handle
90  * @param[in] type Notification image type
91  * @param[out] image_path Image file full path
92  * @return NOTIFICATION_ERROR_NONE on success,
93  *         other value on failure
94  * @retval NOTIFICATION_ERROR_NONE Success
95  * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
96  * @pre Notification handle should be created by notification_create().
97  * @see #notification_image_type_e
98  * @see notification_create()
99  * @par Sample code:
100  * @code
101 #include <notification.h>
102
103 {
104         char *image_path = NULL;
105         int noti_err = NOTIFICATION_ERROR_NONE;
106
107         noti_err = notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, &image_path);
108         if (noti_err != NOTIFICATION_ERROR_NONE)
109                 return;
110 }
111  * @endcode
112  */
113 int notification_get_image(notification_h noti, notification_image_type_e type, char **image_path);
114
115
116 /**
117  * @brief Sets a timestamp.
118  * @details If input_time is @c 0, time information is taken from the current time.
119  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
120  * @param[in] noti The notification handle
121  * @param[in] input_time The input time. If you want the time stamp to not be shown, set this as NOTIFICATION_DO_NOT_SHOW_TIME_STAMP
122  * @return #NOTIFICATION_ERROR_NONE on success,
123  *         otherwise any other value on failure
124  * @retval #NOTIFICATION_ERROR_NONE Success
125  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
126  * @pre Notification handle should be created by notification_create().
127  * @see notification_create()
128  * @see NOTIFICATION_DO_NOT_SHOW_TIME_STAMP
129  * @par Sample code:
130  * @code
131 #include <notification.h>
132
133 {
134         notification_h noti = NULL;
135         int noti_err = NOTIFICATION_ERROR_NONE;
136
137         noti = notification_create(NOTIFICATION_TYPE_NOTI);
138         if (noti == NULL)
139                 return;
140
141         noti_err = notification_set_time(noti, time(NULL));
142         if (noti_err != NOTIFICATION_ERROR_NONE) {
143                 notification_free(noti);
144                 return;
145         }
146 }
147  * @endcode
148  */
149 int notification_set_time(notification_h noti, time_t input_time);
150
151
152 /**
153  * @brief Gets a timestamp.
154  * @details If ret_time is @c 0, time information is not set before.
155  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
156  * @param[in] noti The notification handle
157  * @param[out] ret_time The return time value
158  * @return #NOTIFICATION_ERROR_NONE on success,
159  *         otherwise any other value on failure
160  * @retval #NOTIFICATION_ERROR_NONE Success
161  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
162  * @pre Notification handle should be created by notification_create().
163  * @see notification_create()
164  * @par Sample code:
165  * @code
166 #include <notification.h>
167
168 {
169         time_t ret_time;
170         int noti_err = NOTIFICATION_ERROR_NONE;
171
172         noti_err = notification_get_time(noti, &ret_time);
173         if (noti_err != NOTIFICATION_ERROR_NONE)
174                 return;
175 }
176  * @endcode
177  */
178 int notification_get_time(notification_h noti, time_t *ret_time);
179
180
181 /**
182  * @brief Gets an insertion timestamp of the notification.
183  * @details If ret_time is @c 0, this notification data is not inserted before.
184  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
185  * @param[in] noti The notification handle
186  * @param[out] ret_time The return time value
187  * @return #NOTIFICATION_ERROR_NONE on success,
188  *         otherwise any other value on failure
189  * @retval #NOTIFICATION_ERROR_NONE Success
190  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
191  * @par Sample code:
192  * @code
193 #include <notification.h>
194
195 {
196         time_t ret_time;
197         int noti_err = NOTIFICATION_ERROR_NONE;
198
199         noti_err = notification_get_insert_time(noti, &ret_time);
200         if (noti_err != NOTIFICATION_ERROR_NONE)
201                 return;
202 }
203  * @endcode
204  */
205 int notification_get_insert_time(notification_h noti, time_t *ret_time);
206
207
208 /**
209  * @brief Sets the text to display on the notification view.
210  * @details Sets title, content string. If the text is formatted data (only %d, %f, %s are supported), type - value pair should be set.
211  *          If %d, the type #NOTIFICATION_VARIABLE_TYPE_INT and the value is an integer.
212  *          If %f, the type #NOTIFICATION_VARIABLE_TYPE_DOUBLE and the value is a double.
213  *          If %s, the type #NOTIFICATION_VARIABLE_TYPE_STRING and the value is a string.
214  *          If the type is #NOTIFICATION_VARIABLE_TYPE_COUNT, notification count is displaying with text.
215  *          If the value is #NOTIFICATION_COUNT_POS_LEFT, count is displayed at the left of the text.
216  *          If the value is #NOTIFICATION_COUNT_POS_IN, count is displayed in the text when text has %d format.
217  *          If the value is #NOTIFICATION_COUNT_POS_RIGHT, count is displayed at the right of the text.
218  *          Variable parameters should be terminated #NOTIFICATION_VARIABLE_TYPE_NONE.
219  *
220  *          Note that You can display the translated contents according to the language of the system.
221  *          The application must supply a String KEY as the fourth argument to support localization.
222  *          If the language on the system changes, the contents of the notification are also translated.
223  *
224  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
225  * @param[in] noti The notification handle
226  * @param[in] type The notification text type
227  * @param[in] text The basic text
228  * @param[in] key The text key for localization
229  * @param[in] args_type The variable parameter that type - value pair
230  * @return #NOTIFICATION_ERROR_NONE on success,
231  *         otherwise any other value on failure
232  * @retval #NOTIFICATION_ERROR_NONE Success
233  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
234  * @pre notification handle should be created by notification_create().
235  * @par Sample code:
236  * @code
237 #include <notification.h>
238
239 {
240         notification_h noti = NULL;
241         int noti_err = NOTIFICATION_ERROR_NONE;
242
243         noti = notification_create(NOTIFICATION_TYPE_NOTI);
244         if (noti == NULL)
245                 return;
246
247         noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
248                         "I'm Title", "IDS_APP_BODY_IM_TITLE", NOTIFICATION_VARIABLE_TYPE_NONE);
249         if (noti_err != NOTIFICATION_ERROR_NONE) {
250                 notification_free(noti);
251                 return;
252         }
253 }
254  * @endcode
255  */
256 int notification_set_text(notification_h noti, notification_text_type_e type,
257                 const char *text, const char *key, int args_type, ...);
258
259
260 /**
261  * @brief Gets the text from the notification handle.
262  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
263  * @param[in] noti The notification handle
264  * @param[in] type The notification text type
265  * @param[out] text The notification text
266  * @return #NOTIFICATION_ERROR_NONE on success,
267  *         otherwise any other value on failure
268  * @retval #NOTIFICATION_ERROR_NONE Success
269  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
270  * @par Sample code:
271  * @code
272 #include <notification.h>
273
274 {
275         notification_h noti = NULL;
276         int noti_err = NOTIFICATION_ERROR_NONE;
277         char *text = NULL;
278
279         noti_err = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, &text);
280         if (noti_err != NOTIFICATION_ERROR_NONE)
281                 return;
282
283 }
284  * @endcode
285  */
286 int notification_get_text(notification_h noti, notification_text_type_e type, char **text);
287
288
289 /**
290  * @brief Sets the timestamp to display on the notification view.
291  * @details The timestamp will be converted to a formatted string and it will be displayed on the set text area.
292  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
293  * @param[in] noti The notification handle
294  * @param[in] type The notification text type
295  * @param[in] time The timestamp
296  * @return #NOTIFICATION_ERROR_NONE on success,
297  *         otherwise any other value on failure
298  * @retval #NOTIFICATION_ERROR_NONE Success
299  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
300  * @pre Notification handle should be created by notification_create().
301  */
302 int notification_set_time_to_text(notification_h noti, notification_text_type_e type, time_t time);
303
304
305 /**
306  * @brief Gets the timestamp from the notification handle.
307  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
308  * @param[in] noti The notification handle
309  * @param[in] type The notification text type
310  * @param[in] time The pointer of time stamp
311  * @return #NOTIFICATION_ERROR_NONE on success,
312  *         otherwise any other value on failure
313  * @retval #NOTIFICATION_ERROR_NONE Success
314  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
315  * @pre Notification handle should be created by notification_create().
316  */
317 int notification_get_time_from_text(notification_h noti, notification_text_type_e type, time_t *time);
318
319
320 /**
321  * @brief Sets the sound type for the notification.
322  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
323  * @param[in] noti The notification handle
324  * @param[in] type The notification sound type
325  * @param[in] path The user sound file path
326  * @return #NOTIFICATION_ERROR_NONE on success,
327  *         otherwise any other value on failure
328  * @retval #NOTIFICATION_ERROR_NONE Success
329  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
330  * @par Sample code:
331  * @code
332 #include <notification.h>
333
334 {
335         notification_h noti = NULL;
336         int noti_err = NOTIFICATION_ERROR_NONE;
337
338         noti_err = notification_set_sound(noti, NOTIFICATION_SOUND_TYPE_DEFAULT, NULL);
339         if (noti_err != NOTIFICATION_ERROR_NONE)
340                 return;
341
342 }
343  * @endcode
344  */
345 int notification_set_sound(notification_h noti, notification_sound_type_e type, const char *path);
346
347
348 /**
349  * @brief Gets the sound type from the notification handle.
350  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
351  * @param[in] noti The notification handle
352  * @param[out] type The notification sound type
353  * @param[out] path The user sound file path
354  * @return #NOTIFICATION_ERROR_NONE on success,
355  *         otherwise any other value on failure
356  * @retval #NOTIFICATION_ERROR_NONE Success
357  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
358  * @par Sample code:
359  * @code
360 #include <notification.h>
361
362 {
363         notification_h noti = NULL;
364         int noti_err = NOTIFICATION_ERROR_NONE;
365         notification_sound_type_e type = NOTIFICATION_SOUND_TYPE_NONE;
366
367         noti_err = notification_get_sound(noti, &type, NULL);
368         if (noti_err != NOTIFICATION_ERROR_NONE)
369                 return;
370
371 }
372  * @endcode
373  */
374 int notification_get_sound(notification_h noti, notification_sound_type_e *type, const char **path);
375
376
377 /**
378  * @brief Sets the vibration type for the notification.
379  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
380  * @param[in] noti The notification handle
381  * @param[in] type The notification vibration type
382  * @param[in] path The user vibration file path
383  * @return #NOTIFICATION_ERROR_NONE on success,
384  *         otherwise any other value on failure
385  * @retval #NOTIFICATION_ERROR_NONE Success
386  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
387  * @par Sample code:
388  * @code
389 #include <notification.h>
390
391 {
392         notification_h noti = NULL;
393         int noti_err = NOTIFICATION_ERROR_NONE;
394
395         noti_err = notification_set_vibration(noti, NOTIFICATION_VIBRATION_TYPE_DEFAULT, NULL);
396         if (noti_err != NOTIFICATION_ERROR_NONE)
397                 return;
398
399 }
400  * @endcode
401  */
402 int notification_set_vibration(notification_h noti, notification_vibration_type_e type, const char *path);
403
404
405 /**
406  * @brief Gets the vibrate type from the notification handle.
407  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
408  * @param[in] noti The notification handle
409  * @param[out] type The notification sound type
410  * @param[out] path The user vibration file path
411  * @return #NOTIFICATION_ERROR_NONE on success,
412  *         otherwise other value on failure
413  * @retval #NOTIFICATION_ERROR_NONE Success
414  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
415  * @par Sample code:
416  * @code
417 #include <notification.h>
418
419 {
420         notification_h noti = NULL;
421         int noti_err = NOTIFICATION_ERROR_NONE;
422         notification_vibration_type_e type = NOTIFICATION_VIBRATION_TYPE_NONE;
423
424         noti_err = notification_get_vibration(noti, &type, NULL);
425         if (noti_err != NOTIFICATION_ERROR_NONE)
426                 return;
427
428 }
429   * @endcode
430   */
431 int notification_get_vibration(notification_h noti, notification_vibration_type_e *type, const char **path);
432
433
434 /**
435  * @brief Sets the LED displaying option.
436  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
437  * @param[in] noti The notification handle
438  * @param[in] operation The LED notification operation
439  * @param[in] led_argb The notification LED color
440  * @return #NOTIFICATION_ERROR_NONE on success,
441  *         otherwise other value on failure
442  * @retval #NOTIFICATION_ERROR_NONE Success
443  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
444  * @par Sample code:
445  * @code
446 #include <notification.h>
447
448 {
449         notification_h noti = NULL;
450         int noti_err = NOTIFICATION_ERROR_NONE;
451
452         noti_err = notification_set_led(noti, NOTIFICATION_LED_OP_ON, NULL);
453         if (noti_err != NOTIFICATION_ERROR_NONE)
454                 return;
455
456 }
457  * @endcode
458  */
459 int notification_set_led(notification_h noti, notification_led_op_e operation, int led_argb);
460
461
462 /**
463  * @brief Gets the LED displaying option from the notification handle.
464  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
465  * @param[in] noti The notification handle
466  * @param[out] operation The LED notification operation
467  * @param[out] led_argb The notification LED color
468  * @return #NOTIFICATION_ERROR_NONE on success,
469  *         otherwise any other value on failure
470  * @retval #NOTIFICATION_ERROR_NONE Success
471  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
472  * @par Sample code:
473  * @code
474 #include <notification.h>
475
476 {
477         notification_h noti = NULL;
478         int noti_err = NOTIFICATION_ERROR_NONE;
479         notification_led_type_e type = NOTIFICATION_LED_OP_OFF;
480
481         noti_err = notification_get_led(noti, &type, NULL);
482         if (noti_err != NOTIFICATION_ERROR_NONE)
483                 return;
484
485 }
486   * @endcode
487   */
488 int notification_get_led(notification_h noti, notification_led_op_e *operation, int *led_argb);
489
490
491 /**
492  * @brief Sets the time period of flashing the LED.
493  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
494  * @param[in] noti The notification handle
495  * @param[in] on_ms The time for turning on the LED
496  * @param[in] off_ms The time for turning off the LED
497  * @return #NOTIFICATION_ERROR_NONE on success,
498  *         otherwise any other value on failure
499  * @retval #NOTIFICATION_ERROR_NONE Success
500  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
501  * @par Sample code:
502  * @code
503 #include <notification.h>
504
505 {
506         notification_h noti = NULL;
507         int noti_err = NOTIFICATION_ERROR_NONE;
508
509         noti_err = notification_set_led_time_period(noti, 100, 100);
510         if (noti_err != NOTIFICATION_ERROR_NONE)
511                 return;
512
513 }
514  * @endcode
515  */
516 int notification_set_led_time_period(notification_h noti, int on_ms, int off_ms);
517
518
519 /**
520  * @brief Gets the time period of flashing the LED from the notification handle.
521  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
522  * @param[in] noti The notification handle
523  * @param[out] on_ms The time for turning on the LED
524  * @param[out] off_ms The time for turning on the LED
525  * @return #NOTIFICATION_ERROR_NONE on success,
526  *         otherwise any other value on failure
527  * @retval #NOTIFICATION_ERROR_NONE Success
528  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
529  * @par Sample code:
530  * @code
531 #include <notification.h>
532
533 {
534         notification_h noti = NULL;
535         int noti_err = NOTIFICATION_ERROR_NONE;
536         int led_on_ms = 0;
537         int led_off_ms = 0;
538
539         noti_err = notification_get_led_time_period(noti, &led_on_ms, &led_off_ms);
540         if (noti_err != NOTIFICATION_ERROR_NONE)
541                 return;
542
543 }
544   * @endcode
545   */
546 int notification_get_led_time_period(notification_h noti, int *on_ms, int *off_ms);
547
548
549 /**
550  * @brief Sets the launch option for a notification.
551  * @details When notification data selected in display application, application launched by app_control_send_launch_request with app_control handle.
552  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
553  * @param[in] noti The notification handle
554  * @param[in] type Launching option type
555  * @param[in] option App Control handler
556  * @return #NOTIFICATION_ERROR_NONE on success,
557  *         otherwise any other value on failure
558  * @retval #NOTIFICATION_ERROR_NONE Success
559  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
560  * @par Sample code:
561  * @code
562 #include <notification.h>
563
564 {
565         notification_h noti = NULL;
566         app_control_h app_control = NULL;
567         int noti_err = NOTIFICATION_ERROR_NONE;
568
569         // Do something
570
571         app_control_create(&app_control);
572         app_control_set_app_id(app_control, "org.tizen.app");
573
574         // Do something
575
576         noti_err = notification_set_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)app_control);
577         if (noti_err != NOTIFICATION_ERROR_NONE) {
578                 app_control_destroy(app_control);
579                 notification_free(noti);
580                 return;
581         }
582
583         app_control_destroy(app_control);
584 }
585  * @endcode
586  */
587 int notification_set_launch_option(notification_h noti, notification_launch_option_type type, void *option);
588
589
590 /**
591  * @brief Gets the launch option from the notification handle.
592  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
593  * @remarks You must release @a app_control using app_control_destroy().
594  * @param[in] noti The notification handle
595  * @param[in] type Launching option type
596  * @param[out] option The pointer of App Control handler
597  * @return #NOTIFICATION_ERROR_NONE on success,
598  *         otherwise any other value on failure
599  * @retval #NOTIFICATION_ERROR_NONE Success
600  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
601  * @par Sample code:
602  * @code
603 #include <notification.h>
604
605 {
606         app_control_h app_control = NULL;
607         app_control_create(&app_control);
608
609         // Do something
610
611         noti_err = notification_get_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)&app_control);
612         if (noti_err != NOTIFICATION_ERROR_NONE)
613                 return;
614 }
615  * @endcode
616  */
617 int notification_get_launch_option(notification_h noti, notification_launch_option_type type, void *option);
618
619
620 /**
621  * @brief Sets the handler for a specific event.
622  * @details When some event occurs on notification, application launched by app_control_send_launch_request with app_control handle. \n
623  *          Setting event handler of a button means that the notification will show the button.
624  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
625  * @param[in] noti The notification handle
626  * @param[in] event_type Event type
627  * @param[in] event_handler App control handle
628  * @return #NOTIFICATION_ERROR_NONE on success,
629  *         otherwise any other value on failure
630  * @retval #NOTIFICATION_ERROR_NONE Success
631  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
632  * @see #notification_event_type_e
633  * @par Sample code:
634  * @code
635 #include <notification.h>
636
637 {
638         notification_h noti = NULL;
639         app_control_h app_control = NULL;
640         int noti_err = NOTIFICATION_ERROR_NONE;
641
642         // Do something
643
644         app_control_create(&app_control);
645         app_control_set_app_id(app_control, "org.tizen.app");
646
647         // Do something
648
649         noti_err = notification_set_event_handler(noti, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, app_control);
650         if (noti_err != NOTIFICATION_ERROR_NONE) {
651                 app_control_destroy(app_control);
652                 notification_free(noti);
653                 return;
654         }
655
656         app_control_destroy(app_control);
657 }
658  * @endcode
659  */
660 int notification_set_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h event_handler);
661
662
663 /**
664  * @brief Gets the event handler of a specific event.
665  * @remarks You must release @a app_control using app_control_destroy().
666  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
667  * @param[in] noti The notification handle
668  * @param[in] event_type Launching option type
669  * @param[out] event_handler The handler of App Control
670  * @return #NOTIFICATION_ERROR_NONE on success,
671  *         otherwise any other value on failure
672  * @retval #NOTIFICATION_ERROR_NONE Success
673  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
674  * @see #notification_event_type_e
675  * @par Sample code:
676  * @code
677 #include <notification.h>
678
679 {
680         app_control_h app_control = NULL;
681         app_control_create(&app_control);
682
683         // Do something
684
685         noti_err = notification_get_event_handler(noti, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, &app_control);
686         if (noti_err != NOTIFICATION_ERROR_NONE) {
687                 notification_free(noti);
688                 return;
689         }
690 }
691  * @endcode
692  */
693 int notification_get_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h *event_handler);
694
695
696 /**
697  * @brief Sets the property of the notification.
698  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
699  * @param[in] noti The notification handle
700  * @param[in] flags The property with | operation
701  * @return #NOTIFICATION_ERROR_NONE on success,
702  *         otherwise any other value on failure
703  * @retval #NOTIFICATION_ERROR_NONE Success
704  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
705  * @par Sample code:
706  * @code
707 #include <notification.h>
708
709 {
710         notification_h noti = NULL;
711         int noti_err = NOTIFICATION_ERROR_NONE;
712         bundle *b = NULL;
713
714         noti = notification_create(NOTIFICATION_TYPE_NOTI);
715         if (noti == NULL)
716                 return;
717
718         noti_err = notification_set_property(noti, NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE | NOTIFICATION_PROP_DISABLE_APP_LAUNCH);
719         if (noti_err != NOTIFICATION_ERROR_NONE) {
720                 notification_free(noti);
721                 return;
722         }
723 }
724  * @endcode
725  */
726 int notification_set_property(notification_h noti, int flags);
727
728
729 /**
730  * @brief Gets the property of the notification from the notification handle.
731  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
732  * @param[in] noti The notification handle
733  * @param[out] flags The notification property
734  * @return #NOTIFICATION_ERROR_NONE on success,
735  *         otherwise any other value on failure
736  * @retval #NOTIFICATION_ERROR_NONE Success
737  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
738  * @par Sample code:
739  * @code
740 #include <notification.h>
741
742 {
743         notification_h noti = NULL;
744         int noti_err = NOTIFICATION_ERROR_NONE;
745         int flags = 0;
746
747         noti_err = notification_get_property(noti, &flags);
748         if (noti_err != NOTIFICATION_ERROR_NONE)
749                 return;
750
751 }
752  * @endcode
753  */
754 int notification_get_property(notification_h noti, int *flags);
755
756
757 /**
758  * @brief Sets applications to display the notification.
759  * @details All display application is enabled(NOTIFICATION_DISPLAY_APP_ALL) if you do not call this API.
760  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
761  * @param[in] noti The notification handle
762  * @param[in] applist The with | operation
763  * @return #NOTIFICATION_ERROR_NONE on success,
764  *         otherwise any other value on failure
765  * @retval #NOTIFICATION_ERROR_NONE Success
766  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
767  * @par Sample code:
768  * @code
769 #include <notification.h>
770
771 {
772         notification_h noti = NULL;
773         int noti_err = NOTIFICATION_ERROR_NONE;
774         bundle *b = NULL;
775
776         noti = notification_create(NOTIFICATION_TYPE_NOTI);
777         if (noti == NULL)
778                 return;
779
780         noti_err = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY |
781                                                         NOTIFICATION_DISPLAY_APP_TICKER | NOTIFICATION_DISPLAY_APP_INDICATOR);
782         if (noti_err != NOTIFICATION_ERROR_NONE) {
783                 notification_free(noti);
784                 return;
785         }
786 }
787  * @endcode
788  */
789 int notification_set_display_applist(notification_h noti, int applist);
790
791
792 /**
793  * @brief Gets the application list displaying the notification from the notification handle.
794  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
795  * @param[in] noti The notification handle
796  * @param[out] applist The display application list
797  * @return #NOTIFICATION_ERROR_NONE on success,
798  *         otherwise any other value on failure
799  * @retval #NOTIFICATION_ERROR_NONE Success
800  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
801  * @par Sample code:
802  * @code
803 #include <notification.h>
804
805 {
806         notification_h noti = NULL;
807         int noti_err = NOTIFICATION_ERROR_NONE;
808         int applist = 0;
809
810         noti_err = notification_get_display_applist(noti, &applist);
811         if (noti_err != NOTIFICATION_ERROR_NONE)
812                 return;
813
814 }
815  * @endcode
816  */
817 int notification_get_display_applist(notification_h noti, int *applist);
818
819
820 /**
821  * @brief Sets the initial size for the ongoing type.
822  * @details After notification_post() call, the size is not updated.
823  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
824  * @param[in] noti The notification handle
825  * @param[in] size The double type size
826  * @return #NOTIFICATION_ERROR_NONE on success,
827  *         otherwise any other value on failure
828  * @retval #NOTIFICATION_ERROR_NONE Success
829  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
830  * @par Sample code:
831  * @code
832 #include <notification.h>
833
834 {
835         notification_h noti = NULL;
836         int noti_err = NOTIFICATION_ERROR_NONE;
837
838         noti = notification_create(NOTIFICATION_TYPE_NOTI);
839         if (noti == NULL)
840                 return;
841
842         noti_err = notification_set_size(noti, 0.0);
843         if (noti_err != NOTIFICATION_ERROR_NONE) {
844                 notification_free(noti);
845                 return;
846         }
847 }
848  * @endcode
849  */
850 int notification_set_size(notification_h noti, double size);
851
852
853 /**
854  * @brief Gets the progress size.
855  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
856  * @param[in] noti The notification handle
857  * @param[out] size The progress size
858  * @return #NOTIFICATION_ERROR_NONE on success,
859  *         otherwise any other value on failure
860  * @retval #NOTIFICATION_ERROR_NONE Success
861  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
862  * @par Sample code:
863  * @code
864 #include <notification.h>
865
866 {
867         notification_h noti = NULL;
868         int noti_err = NOTIFICATION_ERROR_NONE;
869         double size = 0.0;
870
871         noti_err = notification_get_size(noti, &size);
872         if (noti_err != NOTIFICATION_ERROR_NONE)
873                 return;
874 }
875  * @endcode
876  */
877 int notification_get_size(notification_h noti, double *size);
878
879
880 /**
881  * @brief Sets the initial progress for the ongoing type.
882  * @details After the notification_post() call, the progress is not updated.
883  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
884  * @param[in] noti The notification handle
885  * @param[in] percentage The progress percentage
886  * @return #NOTIFICATION_ERROR_NONE on success,
887  *         otherwise any other value on failure
888  * @retval #NOTIFICATION_ERROR_NONE Success
889  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
890  * @par Sample code:
891  * @code
892 #include <notification.h>
893
894 {
895         notification_h noti = NULL;
896         int noti_err = NOTIFICATION_ERROR_NONE;
897
898         noti = notification_create(NOTIFICATION_TYPE_NOTI);
899         if (noti == NULL)
900                 return;
901
902         noti_err = notification_set_progress(noti, 0.0);
903         if (noti_err != NOTIFICATION_ERROR_NONE) {
904                 notification_free(noti);
905                 return;
906         }
907 }
908  * @endcode
909  */
910 int notification_set_progress(notification_h noti, double percentage);
911
912
913 /**
914  * @brief Gets the progress from the notification handle.
915  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
916  * @remarks At the end of the operation, the progress should be @c 1.0.
917  * @param[in] noti The notification handle
918  * @param[out] percentage The progress percentage
919  * @return #NOTIFICATION_ERROR_NONE on success,
920  *         otherwise any other value on failure
921  * @retval #NOTIFICATION_ERROR_NONE Success
922  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
923  * @par Sample code:
924  * @code
925 #include <notification.h>
926
927 {
928         notification_h noti = NULL;
929         int noti_err = NOTIFICATION_ERROR_NONE;
930         double percentage = 0.0;
931
932         noti_err = notification_get_progress(noti, &percentage);
933         if (noti_err != NOTIFICATION_ERROR_NONE)
934                 return;
935
936 }
937  * @endcode
938  */
939 int notification_get_progress(notification_h noti, double *percentage);
940
941
942 /**
943  * @brief Sets the layout of the notification view.
944  * @details Caller can set displaying layout of notification.
945  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
946  * @param[in] noti The notification handle
947  * @param[in] layout The type of layout
948  * @return #NOTIFICATION_ERROR_NONE on success,
949  *         otherwise any other value on failure
950  * @retval #NOTIFICATION_ERROR_NONE Success
951  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
952  * @see #notification_ly_type_e
953  */
954 int notification_set_layout(notification_h noti, notification_ly_type_e layout);
955
956
957 /**
958  * @brief Gets the layout of the notification view from the notification handle.
959  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
960  * @param[in] noti The notification handle
961  * @param[out] layout The type of layout
962  * @return #NOTIFICATION_ERROR_NONE on success,
963  *         otherwise any other value on failure
964  * @retval #NOTIFICATION_ERROR_NONE Success
965  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
966  * @see #notification_ly_type_e
967  */
968 int notification_get_layout(notification_h noti, notification_ly_type_e *layout);
969
970
971 /**
972  * @brief Gets the type of a notification.
973  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
974  * @param[in] noti The notification handle
975  * @param[out] type The notification type
976  * @return #NOTIFICATION_ERROR_NONE on success,
977  *         otherwise any other value on failure
978  * @retval #NOTIFICATION_ERROR_NONE Success
979  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
980  * @par Sample code:
981  * @code
982 #include <notification.h>
983
984 {
985         int noti_err = NOTIFICATION_ERROR_NONE;
986         notification_type_e type;
987
988         noti_err = notification_get_type(noti, &type);
989         if (noti_err != NOTIFICATION_ERROR_NONE)
990                 return;
991 }
992  * @endcode
993  */
994 int notification_get_type(notification_h noti, notification_type_e *type);
995
996
997 /**
998  * @brief Updates notification data.
999  * @details The updated notification will appear in the notification area.
1000  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1001  * @privlevel public
1002  * @privilege %http://tizen.org/privilege/notification
1003  * @param[in] noti The notification handle that is created by notification_create()
1004  * @return #NOTIFICATION_ERROR_NONE on success,
1005  *         otherwise any other value on failure
1006  * @retval #NOTIFICATION_ERROR_NONE Success
1007  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1008  * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Priv ID does not exist
1009  * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1010  * @par Sample code:
1011  * @code
1012 #include <notification.h>
1013
1014 {
1015         int noti_err = NOTIFICATION_ERROR_NONE;
1016
1017         noti_err = notification_update(NULL);
1018         if (noti_err != NOTIFICATION_ERROR_NONE)
1019                 return;
1020 }
1021  * @endcode
1022  */
1023 int notification_update(notification_h noti);
1024
1025
1026 /**
1027  * @brief Deletes a notification with the given handle.
1028  * @details notification_delete() removes notification data from database and notification_free() releases memory of notification data.
1029  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1030  * @privlevel public
1031  * @privilege %http://tizen.org/privilege/notification
1032  * @param[in] noti The notification handle
1033  * @return #NOTIFICATION_ERROR_NONE on success,
1034  *         otherwise any other value on failure
1035  * @retval #NOTIFICATION_ERROR_NONE Success
1036  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1037  * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1038  * @par Sample code:
1039  * @code
1040 #include <notification.h>
1041
1042 {
1043         notification_h noti = NULL;
1044         int noti_err = NOTIFICATION_ERROR_NONE;
1045
1046         // Do something
1047
1048         noti_err = notification_delete(noti);
1049         if (noti_err != NOTIFICATION_ERROR_NONE)
1050                 return;
1051
1052 }
1053  * @endcode
1054  */
1055 int notification_delete(notification_h noti);
1056
1057
1058 /**
1059  * @brief Creates internal structure data and returns a notification handle.
1060  * @details Available type is #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING.
1061  *          #NOTIFICATION_TYPE_NOTI is remaining notification data even if device is restarted.
1062  *          #NOTIFICATION_TYPE_ONGOING can display progress on a notification with #NOTIFICATION_LY_ONGOING_PROGRESS layout.
1063  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1064  * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1065  * @param[in] type The notification type
1066  * @return Notification handle(notification_h) on success,
1067  *         otherwise @c NULL on failure
1068  * @retval notification_h Success
1069  * @retval NULL Failure
1070  * @exception #NOTIFICATION_ERROR_NONE Success
1071  * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1072  * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1073  * @see #notification_type_e
1074  * @par Sample code:
1075  * @code
1076 #include <notification.h>
1077
1078 {
1079         notification_h noti = NULL;
1080
1081         noti = notification_create(NOTIFICATION_TYPE_NOTI);
1082         if (noti == NULL)
1083                 return;
1084
1085         // Do something
1086
1087 }
1088  * @endcode
1089  */
1090 notification_h notification_create(notification_type_e type);
1091
1092
1093 /**
1094  * @brief Creates a notification clone.
1095  * @details Newly created notification handle is returned.
1096  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1097  * @remarks This cloned notification handle should be freed using notification_free().
1098  * @param[in] noti The notification handle
1099  * @param[out] clone The newly created notification handle that has same with input @a noti
1100  * @return #NOTIFICATION_ERROR_NONE if success,
1101  *         otherwise any other value if failure
1102  * @retval #NOTIFICATION_ERROR_NONE Success
1103  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1104  * @see #notification_type_e
1105  * @par Sample code:
1106  * @code
1107 #include <notification.h>
1108
1109 {
1110         notification_h noti = notification_create(NOTIFICATION_TYPE_NOTI);
1111         notification_h clone = NULL;
1112
1113         notification_clone(noti, &clone);
1114
1115         // Do something
1116
1117 }
1118  * @endcode
1119  */
1120 int notification_clone(notification_h noti, notification_h *clone);
1121
1122
1123 /**
1124  * @brief Frees the internal structure data of a notification handle.
1125  * @details Internal data of a notification handle is released. Data of the inserted notification is not deleted.
1126  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1127  * @param[in] noti The notification handle
1128  * @return #NOTIFICATION_ERROR_NONE on success,
1129  *         otherwise any other value on failure
1130  * @retval #NOTIFICATION_ERROR_NONE Success
1131  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1132  * @pre Notification handle should be created by notification_create().
1133  * @par Sample code:
1134  * @code
1135 #include <notification.h>
1136
1137 {
1138         notification_h noti = NULL;
1139         int noti_err = NOTIFICATION_ERROR_NONE;
1140
1141         noti = notification_create(NOTIFICATION_TYPE_NOTI);
1142         if (noti == NULL)
1143                 return;
1144
1145         // Do something
1146
1147         noti_err = notification_free(noti);
1148         if (noti_err != NOTIFICATION_ERROR_NONE)
1149                 return;
1150
1151 }
1152  * @endcode
1153  */
1154 int notification_free(notification_h noti);
1155
1156
1157 /**
1158  * @}
1159  */
1160
1161
1162 /**
1163  * @addtogroup NOTIFICATION_MODULE
1164  * @{
1165  */
1166
1167
1168 /**
1169  * @brief Sets the tag of the notification handle.
1170  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1171  * @param[in] noti Notification handle
1172  * @param[in] tag Tag for loading notification handle
1173  * @return #NOTIFICATION_ERROR_NONE on success,
1174  *         other value on failure
1175  * @retval #NOTIFICATION_ERROR_NONE Success
1176  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1177  * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1178  * @see notification_get_tag()
1179  * @par Sample code:
1180  * @code
1181 #include <notification.h>
1182
1183 {
1184         notification_h noti = NULL;
1185         int noti_err = NOTIFICATION_ERROR_NONE;
1186
1187         noti = notification_create(NOTIFICATION_TYPE_NOTI);
1188         if (noti == NULL)
1189                 return;
1190
1191         // Do something
1192
1193         noti_err = notification_set_tag(noti, tag);
1194         if (noti_err != NOTIFICATION_ERROR_NONE)
1195                 return;
1196
1197 }
1198  * @endcode
1199  */
1200 int notification_set_tag(notification_h noti, const char *tag);
1201
1202
1203 /**
1204  * @brief Gets the tag of the notification handle.
1205  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1206  * @param[in] noti Notification handle
1207  * @param[out] tag Tag for loading notification handle
1208  * @return #NOTIFICATION_ERROR_NONE on success,
1209  *         other value on failure
1210  * @retval #NOTIFICATION_ERROR_NONE Success
1211  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1212  * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1213  * @see notification_set_tag()
1214  * @par Sample code:
1215  * @code
1216 #include <notification.h>
1217
1218 {
1219         int noti_err = NOTIFICATION_ERROR_NONE;
1220         const char *tag = NULL;
1221
1222         // Do something
1223
1224         noti_err = notification_get_tag(noti, &tag);
1225         if (noti_err != NOTIFICATION_ERROR_NONE)
1226                 return;
1227
1228 }
1229  * @endcode
1230  */
1231 int notification_get_tag(notification_h noti, const char **tag);
1232
1233
1234 /**
1235  * @brief Loads a notification from the notification's database with the tag.
1236  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1237  * @privlevel public
1238  * @privilege %http://tizen.org/privilege/notification
1239  * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1240  * @param[in] tag Tag for loading notification handle
1241  * @return Notification handle(notification_h) on success,
1242  *         NULL on failure
1243  * @retval notification_h Success
1244  * @retval NULL Failure
1245  * @exception #NOTIFICATION_ERROR_NONE Success
1246  * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1247  * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1248  * @exception #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1249  * @see #notification_type_e
1250  * @par Sample code:
1251  * @code
1252 #include <notification.h>
1253
1254 {
1255         notification_h noti = NULL;
1256
1257         noti = notification_load_by_tag(tag);
1258         if (noti == NULL)
1259                 return;
1260
1261         // Do something
1262
1263 }
1264  * @endcode
1265  */
1266 notification_h notification_load_by_tag(const char *tag);
1267
1268
1269 /**
1270  * @brief Deletes all notifications of the given type.
1271  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1272  * @privlevel public
1273  * @privilege %http://tizen.org/privilege/notification
1274  * @param[in] type Notification type
1275  * @return #NOTIFICATION_ERROR_NONE if success,
1276  *         other value if failure
1277  * @retval #NOTIFICATION_ERROR_NONE Success
1278  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1279  * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1280  * @par Sample code:
1281  * @code
1282 #include <notification.h>
1283
1284 {
1285         int noti_err = NOTIFICATION_ERROR_NONE;
1286
1287         noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
1288         if (noti_err != NOTIFICATION_ERROR_NONE)
1289                 return;
1290
1291 }
1292  * @endcode
1293  */
1294 int notification_delete_all(notification_type_e type);
1295
1296
1297 /**
1298  * @brief Posts a notification.
1299  * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1300  * @privlevel public
1301  * @privilege %http://tizen.org/privilege/notification
1302  * @param[in] noti Notification handle
1303  * @return #NOTIFICATION_ERROR_NONE if success,
1304  *         other value if failure
1305  * @retval #NOTIFICATION_ERROR_NONE Success
1306  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1307  * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1308  * @pre Notification handle should be created by notification_create().
1309  * @post notification_free().
1310  * @par Sample code:
1311  * @code
1312 #include <notification.h>
1313
1314 {
1315         int noti_err = NOTIFICATION_ERROR_NONE;
1316
1317         noti_err = notification_post(noti);
1318         if (noti_err != NOTIFICATION_ERROR_NONE)
1319                 return;
1320
1321 }
1322  * @endcode
1323  */
1324 int notification_post(notification_h noti);
1325
1326
1327 /**
1328  * @brief Gets the package name of the notification.
1329  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1330  * @param[in] noti Notification handle
1331  * @param[out] pkgname The package name of the notification
1332  * @return #NOTIFICATION_ERROR_NONE on success,
1333  *         otherwise a negative error value
1334  * @retval NOTIFICATION_ERROR_NONE Success
1335  * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1336  * @par Sample code:
1337  * @code
1338 #include <notification.h>
1339
1340 {
1341         notification_h noti = NULL;
1342         int noti_err = NOTIFICATION_ERROR_NONE;
1343         char *pkgname = NULL;
1344
1345         // Do something
1346
1347         noti_err = notification_get_pkgname(noti, &pkgname);
1348
1349         if (noti_err != NOTIFICATION_ERROR_NONE) {
1350                 notification_free(noti);
1351                 return;
1352         }
1353 }
1354  * @endcode
1355  */
1356 int notification_get_pkgname(notification_h noti, char **pkgname);
1357
1358
1359 /**
1360  * @brief Adds a button on the notification.
1361  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1362  * @param[in] noti Notification handle
1363  * @param[in] button_index Button index
1364  * @return #NOTIFICATION_ERROR_NONE on success,
1365  *         otherwise a negative error value
1366  * @retval NOTIFICATION_ERROR_NONE Success
1367  * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1368  * @par Sample code:
1369  * @code
1370 #include <notification.h>
1371
1372 {
1373         notification_h noti = NULL;
1374         int noti_err = NOTIFICATION_ERROR_NONE;
1375         char *pkgname = NULL;
1376
1377         // Do something
1378
1379         noti_err = notification_add_button(noti, NOTIFICATION_BUTTON_1);
1380
1381         if (noti_err != NOTIFICATION_ERROR_NONE) {
1382                 notification_free(noti);
1383                 return;
1384         }
1385 }
1386  * @endcode
1387  */
1388 int notification_add_button(notification_h noti, notification_button_index_e button_index);
1389
1390 /**
1391  * @brief Removes a button on the notification.
1392  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1393  * @param[in] noti Notification handle
1394  * @param[in] button_index Button index
1395  * @return #NOTIFICATION_ERROR_NONE on success,
1396  *         otherwise a negative error value
1397  * @retval NOTIFICATION_ERROR_NONE Success
1398  * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1399  * @par Sample code:
1400  * @code
1401 #include <notification.h>
1402
1403 {
1404         notification_h noti = NULL;
1405         int noti_err = NOTIFICATION_ERROR_NONE;
1406         char *pkgname = NULL;
1407
1408         // Do something
1409
1410         noti_err = notification_remove_button(noti, NOTIFICATION_BUTTON_1);
1411
1412         if (noti_err != NOTIFICATION_ERROR_NONE) {
1413                 notification_free(noti);
1414                 return;
1415         }
1416 }
1417  * @endcode
1418  */
1419 int notification_remove_button(notification_h noti, notification_button_index_e button_index);
1420
1421
1422 /**
1423  * @brief Sets the 'auto remove' option of the active notification.
1424  * @details The 'auto remove' option lets the active notification be removed several seconds after it shows. Default value is true.
1425  * @remarks When 'auto_remove' is set as false, the active notification will not be removed
1426  *          as long as the user removes the active notification or the app which posted the active notification removes the active notification.
1427  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1428  * @param[in] noti Notification handle
1429  * @param[in] auto_remove Auto remove option
1430  * @return #NOTIFICATION_ERROR_NONE On success,
1431  *         other value if failure
1432  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1433  * @see #notification_h
1434  * @see #notification_get_auto_remove
1435  * @par Sample code:
1436  * @code
1437 #include <notification.h>
1438
1439 {
1440         notification_h noti = NULL;
1441         int noti_err = NOTIFICATION_ERROR_NONE;
1442
1443         // Do something
1444
1445         noti_err = notification_set_auto_remove(noti, false);
1446         if (noti_err != NOTIFICATION_ERROR_NONE)
1447                 return;
1448
1449 }
1450  * @endcode
1451  */
1452 int notification_set_auto_remove(notification_h noti, bool auto_remove);
1453
1454
1455 /**
1456  * @brief Gets the 'auto remove' option of the active notification.
1457  * @details The 'auto remove' option lets the active notification be removed several seconds after it shows. Default value is true.
1458  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1459  * @param[in] noti Notification handle
1460  * @param[out] auto_remove Auto remove option
1461  * @return #NOTIFICATION_ERROR_NONE On success, other value on failure
1462  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1463  * @see #notification_h
1464  * @see #notification_get_auto_remove
1465  * @par Sample code:
1466  * @code
1467 #include <notification.h>
1468
1469 {
1470         int noti_err = NOTIFICATION_ERROR_NONE;
1471         bool auto_remove;
1472
1473         // Do something
1474
1475         noti_err = notification_get_auto_remove(noti, &auto_remove);
1476         if (noti_err != NOTIFICATION_ERROR_NONE)
1477                 return;
1478
1479 }
1480  * @endcode
1481  */
1482 int notification_get_auto_remove(notification_h noti, bool *auto_remove);
1483
1484
1485 /**
1486  * @brief Saves a notification template to the notification database.
1487  * @details An application can save the created notification as a template for later reuse.
1488  *          If the template has the same name as a saved one, the saved template will be overwritten.
1489  *          A saved template can be loaded only by the application which saved it.
1490  *          All templates are removed when the application package is uninstalled.
1491  * @since_tizen 3.0
1492  * @privlevel public
1493  * @privilege %http://tizen.org/privilege/notification
1494  * @remarks The number of templates is limited to 10.
1495  *          When you try to add more than 10 templates, #NOTIFICATION_ERROR_MAX_EXCEEDED will be returned.
1496  * @param[in] noti Notification handle
1497  * @param[in] template_name Template name
1498  * @return #NOTIFICATION_ERROR_NONE On success, other value on failure
1499  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1500  * @retval #NOTIFICATION_ERROR_IO_ERROR I/O error
1501  * @retval #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1502  * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The Permission denied
1503  * @retval #NOTIFICATION_ERROR_MAX_EXCEEDED Max notification count exceeded
1504  * @see #notification_h
1505  * @see notification_create_from_template()
1506  * @par Sample code:
1507  * @code
1508 #include <notification.h>
1509
1510 {
1511         int noti_err = NOTIFICATION_ERROR_NONE;
1512         notification_h noti = NULL;
1513
1514         noti = notification_create(NOTIFICATION_TYPE_NOTI);
1515         if (noti == NULL)
1516                 return;
1517
1518         // add the content you want to use for the template.
1519
1520         noti_err = notification_save_as_template(noti, "CALL_ACCEPT");
1521         if (noti_err != NOTIFICATION_ERROR_NONE)
1522                 return;
1523
1524         noti_err = notification_free(noti);
1525         if (noti_err != NOTIFICATION_ERROR_NONE)
1526                 return;
1527 }
1528  * @endcode
1529  */
1530 int notification_save_as_template(notification_h noti, const char *template_name);
1531
1532
1533 /**
1534  * @brief Loads a notification template from the notification database.
1535  * @details An application can load a saved template and post it.
1536  *          An application can load only templates that it has saved.
1537  * @since_tizen 3.0
1538  * @privlevel public
1539  * @privilege %http://tizen.org/privilege/notification
1540  * @remarks The returned handle should be destroyed using notification_free().
1541  *          The specific error code can be obtained using get_last_result().
1542  *          Error codes are described in the Exception section.
1543  *          If an invalid template name is given, the result will be set to #NOTIFICATION_ERROR_FROM_DB.
1544  * @param[in] template_name Template name
1545  * @return Notification handle on success, NULL on failure
1546  * @exception #NOTIFICATION_ERROR_NONE Success
1547  * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1548  * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1549  * @exception #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1550  * @exception #NOTIFICATION_ERROR_FROM_DB Error from DB query
1551  * @see #notification_h
1552  * @see notification_save_as_template()
1553  * @par Sample code:
1554  * @code
1555 #include <notification.h>
1556
1557 {
1558         notification_h noti = NULL;
1559
1560         noti = notification_create_from_template("CALL_ACCEPT");
1561         if (noti == NULL)
1562                 return;
1563
1564 }
1565  * @endcode
1566  */
1567 notification_h notification_create_from_template(const char *template_name);
1568
1569
1570 /**
1571  * @brief Gets notification block state.
1572  * @details     The user can set the notification block state in settings.
1573  *              The block state indicates whether or not notifications can be posted.
1574  *              Additionally only notifications to the notification panel are
1575  *              allowed in "Do not disturb mode". Sound, Vibrate and
1576  *              Active/Instant notifications are blocked.
1577  * @since_tizen 3.0
1578  * @privlevel public
1579  * @privilege %http://tizen.org/privilege/notification
1580  * @param[out] state Notification block state
1581  * @return #NOTIFICATION_ERROR_NONE On success, other value on failure
1582  * @retval #NOTIFICATION_ERROR_NONE Success
1583  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1584  * @retval #NOTIFICATION_ERROR_OUT_OF_MEMORY out of memory
1585  * @retval #NOTIFICATION_ERROR_IO_ERROR I/O Error
1586  * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED Permission denied
1587  * @retval #NOTIFICATION_ERROR_SERVICE_NOT_READY No response from notification service
1588  * @see #notification_block_state_e
1589  * @par Sample code:
1590  * @code
1591 #include <notification.h>
1592
1593 {
1594         int noti_err = NOTIFICATION_ERROR_NONE;
1595         notification_block_state_e state;
1596
1597         // Do something
1598
1599         noti_err = notification_get_noti_block_state(&state);
1600         if (noti_err != NOTIFICATION_ERROR_NONE)
1601                 return;
1602
1603 }
1604  * @endcode
1605  */
1606 int notification_get_noti_block_state(notification_block_state_e *state);
1607
1608
1609 /**
1610  * @brief Sets a text input box to reply directly on the notification.
1611  * @details When you add a text input to the active notification, the notification UI will show a text input with a button.
1612  *          So, the user can enter any text and press the button to confirm the text as a input.
1613  *          You can edit some UI component that is related to the text input.
1614  *          First, you can add placeholder text to guide the user using notification_set_text() with #NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER type.
1615  *          You also can edit button for the text input.
1616  *          For setting just a text to the button, you can set the text using notification_set_text() with #NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON type.
1617  *          If you want to show image button, you can set an image for the button using notification_set_image() with #NOTIFICATION_IMAGE_TYPE_TEXT_INPUT_BUTTON type.
1618  *
1619  *          Note that you should set an app_control for handling the event for user input using notification_set_event_handler().
1620  *          #NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON is the event type for the text input.
1621  *          You can get the text the user enters in the app_control handle that is passed as a result of the event.
1622  *          The app_control will contain APP_CONTROL_DATA_TEXT key, so you can get the text using app_control_get_extra_data() using APP_CONTROL_DATA_TEXT key.
1623  *          The value will contain the text user enters.
1624  *
1625  *          Note that you are able to make the switching button to the text input box.
1626  *          You have to set the app_control which you will set in a text input box to the switching button.
1627  *          Refer to the second sample code.
1628  * @since_tizen 3.0
1629  * @param[in] noti Notification handle
1630  * @param[in] text_input_max_length The maximum value which can be inputted
1631  * @return #NOTIFICATION_ERROR_NONE on success,
1632  *         otherwise any other value on failure
1633  * @retval #NOTIFICATION_ERROR_NONE         Success
1634  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1635  * @par Sample code:
1636  * @code
1637 #include <notification.h>
1638
1639 {
1640         int noti_err = NOTIFICATION_ERROR_NONE;
1641         notification_h noti = NULL;
1642         app_control = NULL;
1643
1644         noti = notification_create(NOTIFICATION_TYPE_NOTI);
1645         if (noti == NULL)
1646                 return;
1647
1648         noti_err = notification_set_text_input(noti, 160);
1649         if (noti_err != NOTIFICATION_ERROR_NONE)
1650                 return;
1651
1652         noti_err = notification_set_text(noti,
1653                         NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER,
1654                         "Text message",
1655                         NULL,
1656                         NOTIFICATION_VARIABLE_TYPE_NONE);
1657         if (noti_err != NOTIFICATION_ERROR_NONE)
1658                 return;
1659
1660         noti_err = notification_set_text(noti,
1661                         NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON,
1662                         "SEND",
1663                         NULL,
1664                         NOTIFICATION_VARIABLE_TYPE_NONE);
1665         if (noti_err != NOTIFICATION_ERROR_NONE)
1666                 return;
1667
1668         noti_err = notification_set_display_applist(noti,
1669                         NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_ACTIVE);
1670         if (noti_err != NOTIFICATION_ERROR_NONE)
1671                 return;
1672
1673         // Do something
1674
1675         noti_err = app_control_create(&app_control);
1676         if (noti_err != APP_CONTROL_ERROR_NONE)
1677                 return;
1678
1679         noti_err = app_control_set_app_id(app_control, appid);
1680         if (noti_err != APP_CONTROL_ERROR_NONE)
1681                 return;
1682
1683         noti_err = app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
1684         if (noti_err != APP_CONTROL_ERROR_NONE)
1685                 return;
1686
1687         noti_err = notification_set_event_handler(noti,
1688                         NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON,
1689                         app_control);
1690         if (noti_err != NOTIFICATION_ERROR_NONE)
1691                 return;
1692
1693         noti_err = app_control_destroy(app_control);
1694         if (noti_err != APP_CONTROL_ERROR_NONE)
1695                 return;
1696
1697         noti_err  = notification_post(noti);
1698         if(noti_err != NOTIFICATION_ERROR_NONE)
1699                 return;
1700
1701 }
1702
1703
1704 {
1705         int noti_err = NOTIFICATION_ERROR_NONE;
1706         notification_h noti = NULL;
1707         app_control = NULL;
1708
1709         noti = notification_create(NOTIFICATION_TYPE_NOTI);
1710         if (noti == NULL) {
1711                 return;
1712         }
1713
1714         noti_err = notification_set_text_input(noti, 160);
1715         if (noti_err != NOTIFICATION_ERROR_NONE)
1716                 return;
1717
1718         noti_err = notification_set_text(noti,
1719                         NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER,
1720                         "Text message",
1721                         NULL,
1722                         NOTIFICATION_VARIABLE_TYPE_NONE);
1723         if (noti_err != NOTIFICATION_ERROR_NONE)
1724                 return;
1725
1726         noti_err = notification_set_text(noti,
1727                         NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON,
1728                         "SEND",
1729                         NULL,
1730                         NOTIFICATION_VARIABLE_TYPE_NONE);
1731         if (noti_err != NOTIFICATION_ERROR_NONE)
1732                 return;
1733
1734         noti_err = notification_add_button(notification, NOTIFICATION_BUTTON_1);
1735         if (noti_err != NOTIFICATION_ERROR_NONE)
1736                 return;
1737
1738         noti_err = notification_set_text(notification,
1739                         NOTIFICATION_TEXT_TYPE_BUTTON_1,
1740                         "reply",
1741                         NULL,
1742                         NOTIFICATION_VARIABLE_TYPE_NONE);
1743         if (noti_err != NOTIFICATION_ERROR_NONE)
1744                 return;
1745
1746         noti_err = notification_set_display_applist(noti,
1747                         NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_ACTIVE);
1748         if (noti_err != NOTIFICATION_ERROR_NONE)
1749                 return;
1750
1751         // Do something
1752
1753         noti_err = app_control_create(&app_control);
1754         if (noti_err != APP_CONTROL_ERROR_NONE)
1755                 return;
1756
1757         noti_err = app_control_set_app_id(app_control, appid);
1758         if (noti_err != APP_CONTROL_ERROR_NONE)
1759                 return;
1760
1761         noti_err = app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
1762         if (noti_err != APP_CONTROL_ERROR_NONE)
1763                 return;
1764
1765         noti_err = notification_set_event_handler(notification,
1766                         NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1,
1767                         app_control);
1768         if (noti_err != NOTIFICATION_ERROR_NONE)
1769                 return;
1770
1771         noti_err = notification_set_event_handler(noti,
1772                         NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON,
1773                         app_control);
1774         if (noti_err != NOTIFICATION_ERROR_NONE)
1775                 return;
1776
1777         noti_err = app_control_destroy(app_control);
1778         if (noti_err != APP_CONTROL_ERROR_NONE)
1779                 return;
1780
1781         noti_err  = notification_post(noti);
1782         if(noti_err != NOTIFICATION_ERROR_NONE)
1783                 return;
1784 }
1785  * @endcode
1786  */
1787 int notification_set_text_input(notification_h noti, int text_input_max_length);
1788
1789
1790 /**
1791  * @brief Sets the image height for the extended notification.
1792  * @details The image is shown under the notification's text. The application can set the image height.
1793  *          The image is modified to fit into the height set by this function.
1794  *          The image can be scaled down and/or cropped.
1795  *          If @a height is 0, the default value is used. The default height depends on the screen size.
1796  * @since_tizen 4.0
1797  * @param[in] noti   The notification handle
1798  * @param[in] height The image height
1799  * @return #NOTIFICATION_ERROR_NONE On success,
1800  *         otherwise a negative error value
1801  * @retval #NOTIFICATION_ERROR_NONE Success
1802  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1803  * @see notification_get_extension_image_size()
1804  * @par Sample code:
1805  * @code
1806 #include <notification.h>
1807
1808 {
1809         notification_h noti = NULL;
1810         int noti_err = NOTIFICATION_ERROR_NONE;
1811
1812         noti = notification_create(NOTIFICATION_TYPE_NOTI);
1813         if (noti == NULL)
1814                 return;
1815
1816         noti_err = notification_set_text(noti,
1817                         NOTIFICATION_TEXT_TYPE_CONTENT_EXTENTION,
1818                         "message",
1819                         NULL,
1820                         NOTIFICATION_VARIABLE_TYPE_NONE);
1821         if (noti_err != NOTIFICATION_ERROR_NONE)
1822                 return;
1823
1824         noti_err = notification_set_image(noti,
1825                         NOTIFICATION_IMAGE_TYPE_EXTENTION,
1826                         image_path);
1827         if (noti_err != NOTIFICATION_ERROR_NONE)
1828                 return;
1829
1830         noti_err = notification_set_layout(noti, NOTIFICATION_LY_EXTENTION);
1831         if (noti_err != NOTIFICATION_ERROR_NONE)
1832                 return;
1833
1834         noti_err = notification_set_extension_image_size(noti, 20);
1835         if (noti_err != NOTIFICATION_ERROR_NONE)
1836                 return;
1837
1838         // Do something
1839 }
1840  * @endcode
1841  */
1842 int notification_set_extension_image_size(notification_h noti, int height);
1843
1844
1845 /**
1846  * @brief Gets the image height for the extended notification.
1847  * @since_tizen 4.0
1848  * @param[in] noti The notification handle
1849  * @param[out] height The image height
1850  * @return #NOTIFICATION_ERROR_NONE On success, otherwise a negative error value
1851  * @retval #NOTIFICATION_ERROR_NONE Success
1852  * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1853  * @see notification_set_extension_image_size()
1854  * @par Sample code:
1855  * @code
1856 #include <notification.h>
1857
1858 {
1859         int noti_err = NOTIFICATION_ERROR_NONE;
1860         int height;
1861
1862         // Do something
1863
1864         noti_err = notification_get_extension_image_size(noti, &height);
1865         if (noti_err != NOTIFICATION_ERROR_NONE)
1866                 return;
1867 }
1868  * @endcode
1869  */
1870 int notification_get_extension_image_size(notification_h noti, int *height);
1871
1872 /**
1873  * @}
1874  */
1875
1876 #ifdef __cplusplus
1877 }
1878 #endif
1879 #endif /* __NOTIFICATION_H__ */
1880