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