4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 #ifndef __NOTIFICATION_H__
23 #define __NOTIFICATION_H__
29 #include <notification_error.h>
30 #include <notification_type.h>
31 #include <notification_status.h>
38 * @file notification.h
39 * @brief This file contains the notification API.
43 * @addtogroup NOTIFICATION_MODULE
48 * @brief Sets an absolute path for an image file to display on the notification view.
49 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
50 * @param[in] noti The notification handle
51 * @param[in] type The notification image type
52 * @param[in] image_path The image file full path
53 * @return #NOTIFICATION_ERROR_NONE on success,
54 * otherwise any other value on failure
55 * @retval #NOTIFICATION_ERROR_NONE Success
56 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
57 * @pre Notification handle should be created by notification_create().
58 * @see #notification_image_type_e
59 * @see notification_create()
62 #include <notification.h>
65 notification_h noti = NULL;
66 int noti_err = NOTIFICATION_ERROR_NONE;
68 noti = notification_create(NOTIFICATION_TYPE_NOTI);
73 noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, APP_IMAGE_FULL_PATH);
74 if(noti_err != NOTIFICATION_ERROR_NONE) {
75 notification_free(noti);
81 int notification_set_image(notification_h noti,
82 notification_image_type_e type,
83 const char *image_path);
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, other value on failure
93 * @retval NOTIFICATION_ERROR_NONE Success
94 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
95 * @pre Notification handle should be created by notification_create().
96 * @see #notification_image_type_e
97 * @see notification_create()
100 #include <notification.h>
103 char *image_path = NULL;
104 int noti_err = NOTIFICATION_ERROR_NONE;
106 noti_err = notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, &image_path);
107 if(noti_err != NOTIFICATION_ERROR_NONE) {
113 int notification_get_image(notification_h noti,
114 notification_image_type_e type,
118 * @brief Sets a timestamp.
119 * @details If input_time is @c 0, time information is taken from the current time.
120 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
121 * @param[in] noti The notification handle
122 * @param[in] input_time The input time. If you want the time stamp is not be shown, set this as NOTIFICATION_DO_NOT_SHOW_TIME_STAMP
123 * @return #NOTIFICATION_ERROR_NONE on success,
124 * otherwise any other value on failure
125 * @retval #NOTIFICATION_ERROR_NONE Success
126 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
127 * @pre Notification handle should be created by notification_create().
128 * @see notification_create()
129 * @see NOTIFICATION_DO_NOT_SHOW_TIME_STAMP
132 #include <notification.h>
135 notification_h noti = NULL;
136 int noti_err = NOTIFICATION_ERROR_NONE;
138 noti = notification_create(NOTIFICATION_TYPE_NOTI);
143 noti_err = notification_set_time(noti, time(NULL));
144 if(noti_err != NOTIFICATION_ERROR_NONE) {
145 notification_free(noti);
151 int notification_set_time(notification_h noti,
155 * @brief Gets a timestamp.
156 * @details If ret_time is @c 0, time information is not set before.
157 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
158 * @param[in] noti The notification handle
159 * @param[out] ret_time The return time value
160 * @return #NOTIFICATION_ERROR_NONE on success,
161 * otherwise any other value on failure
162 * @retval #NOTIFICATION_ERROR_NONE Success
163 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
164 * @pre Notification handle should be created by notification_create().
165 * @see notification_create()
168 #include <notification.h>
172 int noti_err = NOTIFICATION_ERROR_NONE;
174 noti_err = notification_get_time(noti, &ret_time);
175 if(noti_err != NOTIFICATION_ERROR_NONE) {
181 int notification_get_time(notification_h noti,
185 * @brief Gets an insertion timestamp of the notification.
186 * @details If ret_time is @c 0, this notification data is not inserted before.
187 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
188 * @param[in] noti The notification handle
189 * @param[out] ret_time The return time value
190 * @return #NOTIFICATION_ERROR_NONE on success,
191 * otherwise any other value on failure
192 * @retval #NOTIFICATION_ERROR_NONE Success
193 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
196 #include <notification.h>
200 int noti_err = NOTIFICATION_ERROR_NONE;
202 noti_err = notification_get_insert_time(noti, &ret_time);
203 if(noti_err != NOTIFICATION_ERROR_NONE) {
209 int notification_get_insert_time(notification_h noti,
213 * @brief Sets the text to display on the notification view.
214 * @details Sets title, content string. If the text is formatted data (only %d, %f, %s are supported), type - value pair should be set.
215 * If %d, the type #NOTIFICATION_VARIABLE_TYPE_INT and the value is an integer.
216 * If %f, the type #NOTIFICATION_VARIABLE_TYPE_DOUBLE and the value is a double.
217 * If %s, the type #NOTIFICATION_VARIABLE_TYPE_STRING and the value is a string.
218 * If the type is #NOTIFICATION_VARIABLE_TYPE_COUNT, notification count is displaying with text.
219 * If the value is #NOTIFICATION_COUNT_POS_LEFT, count is displayed at the left of the text.
220 * If the value is #NOTIFICATION_COUNT_POS_IN, count is displayed in the text when text has %d format.
221 * If the value is #NOTIFICATION_COUNT_POS_RIGHT, count is displayed at the right of the text.
222 * Variable parameters should be terminated #NOTIFICATION_VARIABLE_TYPE_NONE.
223 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
224 * @param[in] noti The notification handle
225 * @param[in] type The notification text type
226 * @param[in] text The basic text
227 * @param[in] key The text key for localization
228 * @param[in] args_type The variable parameter that type - value pair
229 * @return #NOTIFICATION_ERROR_NONE on success,
230 * otherwise any other value on failure
231 * @retval #NOTIFICATION_ERROR_NONE Success
232 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
233 * @pre notification handle should be created by notification_create().
236 #include <notification.h>
239 notification_h noti = NULL;
240 int noti_err = NOTIFICATION_ERROR_NONE;
242 noti = notification_create(NOTIFICATION_TYPE_NOTI);
247 noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "I'm Title", "IDS_APP_BODY_IM_TITLE", NOTIFICATION_VARIABLE_TYPE_NONE);
248 if(noti_err != NOTIFICATION_ERROR_NONE) {
249 notification_free(noti);
255 int notification_set_text(notification_h noti,
256 notification_text_type_e type,
262 * @brief Gets the text from the notification handle.
263 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
264 * @param[in] noti The notification handle
265 * @param[in] type The notification text type
266 * @param[out] text The notification text
267 * @return #NOTIFICATION_ERROR_NONE on success,
268 * otherwise any other value on failure
269 * @retval #NOTIFICATION_ERROR_NONE Success
270 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
273 #include <notification.h>
276 notification_h noti = NULL;
277 int noti_err = NOTIFICATION_ERROR_NONE;
280 noti_err = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, &text);
281 if(noti_err != NOTIFICATION_ERROR_NONE) {
287 int notification_get_text(notification_h noti,
288 notification_text_type_e type,
292 * @brief Sets the timestamp to display on the notification view.
293 * @details The timestamp will be converted to a formatted string and it will be displayed on the set text area.
294 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
295 * @param[in] noti The notification handle
296 * @param[in] type The notification text type
297 * @param[in] time The timestamp
298 * @return #NOTIFICATION_ERROR_NONE on success,
299 * otherwise any other value on failure
300 * @retval #NOTIFICATION_ERROR_NONE Success
301 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
302 * @pre Notification handle should be created by notification_create().
304 int notification_set_time_to_text(notification_h noti, notification_text_type_e type,
308 * @brief Gets the timestamp from the notification handle.
309 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
310 * @param[in] noti The notification handle
311 * @param[in] type The notification text type
312 * @param[in] time The pointer of time stamp
313 * @return #NOTIFICATION_ERROR_NONE on success,
314 * otherwise any other value on failure
315 * @retval #NOTIFICATION_ERROR_NONE Success
316 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
317 * @pre Notification handle should be created by notification_create().
319 int notification_get_time_from_text(notification_h noti, notification_text_type_e type,
323 * @brief Sets the sound type for the notification.
324 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
325 * @param[in] noti The notification handle
326 * @param[in] type The notification sound type
327 * @param[in] path The user sound file path
328 * @return #NOTIFICATION_ERROR_NONE on success,
329 * otherwise any other value on failure
330 * @retval #NOTIFICATION_ERROR_NONE Success
331 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
334 #include <notification.h>
337 notification_h noti = NULL;
338 int noti_err = NOTIFICATION_ERROR_NONE;
340 noti_err = notification_set_sound(noti, NOTIFICATION_SOUND_TYPE_DEFAULT, NULL);
341 if(noti_err != NOTIFICATION_ERROR_NONE) {
347 int notification_set_sound(notification_h noti,
348 notification_sound_type_e type,
352 * @brief Gets the sound type from the notification handle.
353 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
354 * @param[in] noti The notification handle
355 * @param[out] type The notification sound type
356 * @param[out] path The user sound file path
357 * @return #NOTIFICATION_ERROR_NONE on success,
358 * otherwise any other value on failure
359 * @retval #NOTIFICATION_ERROR_NONE Success
360 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
363 #include <notification.h>
366 notification_h noti = NULL;
367 int noti_err = NOTIFICATION_ERROR_NONE;
368 notification_sound_type_e type = NOTIFICATION_SOUND_TYPE_NONE;
370 noti_err = notification_get_sound(noti, &type, NULL);
371 if(noti_err != NOTIFICATION_ERROR_NONE) {
377 int notification_get_sound(notification_h noti,
378 notification_sound_type_e *type,
382 * @brief Sets the vibration type for the notification.
383 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
384 * @param[in] noti The notification handle
385 * @param[in] type The notification vibration type
386 * @param[in] path The user vibration file path
387 * @return #NOTIFICATION_ERROR_NONE on success,
388 * otherwise any other value on failure
389 * @retval #NOTIFICATION_ERROR_NONE Success
390 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
393 #include <notification.h>
396 notification_h noti = NULL;
397 int noti_err = NOTIFICATION_ERROR_NONE;
399 noti_err = notification_set_vibration(noti, NOTIFICATION_VIBRATION_TYPE_DEFAULT, NULL);
400 if(noti_err != NOTIFICATION_ERROR_NONE) {
406 int notification_set_vibration(notification_h noti,
407 notification_vibration_type_e type,
411 * @brief Gets the vibrate type from the notification handle.
412 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
413 * @param[in] noti The notification handle
414 * @param[out] type The notification sound type
415 * @param[out] path The user vibration file path
416 * @return #NOTIFICATION_ERROR_NONE on success,
417 * otherwise other value on failure
418 * @retval #NOTIFICATION_ERROR_NONE Success
419 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
422 #include <notification.h>
425 notification_h noti = NULL;
426 int noti_err = NOTIFICATION_ERROR_NONE;
427 notification_vibration_type_e type = NOTIFICATION_VIBRATION_TYPE_NONE;
429 noti_err = notification_get_vibration(noti, &type, NULL);
430 if(noti_err != NOTIFICATION_ERROR_NONE) {
436 int notification_get_vibration(notification_h noti,
437 notification_vibration_type_e *type,
441 * @brief Sets the LED displaying option.
442 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
443 * @param[in] noti The notification handle
444 * @param[in] operation The LED notification operation
445 * @param[in] led_argb The notification led color
446 * @return #NOTIFICATION_ERROR_NONE on success,
447 * otherwise other value on failure
448 * @retval #NOTIFICATION_ERROR_NONE Success
449 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
452 #include <notification.h>
455 notification_h noti = NULL;
456 int noti_err = NOTIFICATION_ERROR_NONE;
458 noti_err = notification_set_led(noti, NOTIFICATION_LED_TYPE_DEFAULT, NULL);
459 if(noti_err != NOTIFICATION_ERROR_NONE) {
465 int notification_set_led(notification_h noti,
466 notification_led_op_e operation,
470 * @brief Gets the LED displaying option from the notification handle.
471 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
472 * @param[in] noti The notification handle
473 * @param[out] operation The LED notification operation
474 * @param[out] led_argb The notification LED color
475 * @return #NOTIFICATION_ERROR_NONE on success,
476 * otherwise any other value on failure
477 * @retval #NOTIFICATION_ERROR_NONE Success
478 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
481 #include <notification.h>
484 notification_h noti = NULL;
485 int noti_err = NOTIFICATION_ERROR_NONE;
486 notification_led_type_e type = NOTIFICATION_LED_TYPE_NONE;
488 noti_err = notification_get_led(noti, &type, NULL);
489 if(noti_err != NOTIFICATION_ERROR_NONE) {
495 int notification_get_led(notification_h noti,
496 notification_led_op_e *operation,
500 * @brief Sets the time period of flashing the LED.
501 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
502 * @param[in] noti The notification handle
503 * @param[in] on_ms The time for turning on the LED
504 * @param[in] off_ms The time for turning off the LED
505 * @return #NOTIFICATION_ERROR_NONE on success,
506 * otherwise any other value on failure
507 * @retval #NOTIFICATION_ERROR_NONE Success
508 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
511 #include <notification.h>
514 notification_h noti = NULL;
515 int noti_err = NOTIFICATION_ERROR_NONE;
517 noti_err = notification_set_led_time_period(noti, 100, 100);
518 if(noti_err != NOTIFICATION_ERROR_NONE) {
524 int notification_set_led_time_period(notification_h noti,
525 int on_ms, int off_ms);
528 * @brief Gets the time period of flashing the LED from the notification handle.
529 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
530 * @param[in] noti The notification handle
531 * @param[out] on_ms The time for turning on the LED
532 * @param[out] off_ms The time for turning on the LED
533 * @return #NOTIFICATION_ERROR_NONE on success,
534 * otherwise any other value on failure
535 * @retval #NOTIFICATION_ERROR_NONE Success
536 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
539 #include <notification.h>
542 notification_h noti = NULL;
543 int noti_err = NOTIFICATION_ERROR_NONE;
547 noti_err = notification_get_led_time_period(noti, &led_on_ms, &led_off_ms);
548 if(noti_err != NOTIFICATION_ERROR_NONE) {
554 int notification_get_led_time_period(notification_h noti,
555 int *on_ms, int *off_ms);
558 * @brief Sets the launch option for a notification.
559 * @details When notification data selected in display application, application launched by app_control_send_launch_request with app_control handle.
560 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
561 * @param[in] noti The notification handle
562 * @param[in] type Launching option type
563 * @param[in] option App Control handler
564 * @return #NOTIFICATION_ERROR_NONE on success,
565 * otherwise any other value on failure
566 * @retval #NOTIFICATION_ERROR_NONE Success
567 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
570 #include <notification.h>
573 notification_h noti = NULL;
574 app_control_h app_control = NULL;
575 int noti_err = NOTIFICATION_ERROR_NONE;
579 app_control_create(&app_control);
580 app_control_set_app_id(app_control, "org.tizen.app");
584 noti_err = notification_set_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)app_control);
585 if(noti_err != NOTIFICATION_ERROR_NONE) {
586 notification_free(noti);
590 app_control_destroy(app_control);
594 int notification_set_launch_option(notification_h noti,
595 notification_launch_option_type type, void *option);
598 * @brief Gets the launch option from the notification handle.
599 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
600 * @remarks You must release @a app_control using app_control_destroy().
601 * @param[in] noti The notification handle
602 * @param[in] type Launching option type
603 * @param[out] option The pointer of App Control handler
604 * @return #NOTIFICATION_ERROR_NONE on success,
605 * otherwise any other value on failure
606 * @retval #NOTIFICATION_ERROR_NONE Success
607 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
610 #include <notification.h>
613 app_control_h app_control = NULL;
614 app_control_create(&app_control);
618 noti_err = notification_get_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)&app_control);
619 if(noti_err != NOTIFICATION_ERROR_NONE) {
620 notification_free(noti);
626 int notification_get_launch_option(notification_h noti,
627 notification_launch_option_type type, void *option);
630 * @brief Sets the handler for a specific event.
631 * @details When some event occurs on notification, application launched by app_control_send_launch_request with app_control handle.\n
632 * Setting event handler of a button means that the notification will show the button.
634 * @param[in] noti The notification handle
635 * @param[in] event_type event type
636 * @param[in] event_handler app control handle
637 * @return #NOTIFICATION_ERROR_NONE on success,
638 * otherwise any other value on failure
639 * @retval #NOTIFICATION_ERROR_NONE Success
640 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
641 * @see #notification_event_type_e
644 #include <notification.h>
647 notification_h noti = NULL;
648 app_control_h app_control = NULL;
649 int noti_err = NOTIFICATION_ERROR_NONE;
653 app_control_create(&app_control);
654 app_control_set_app_id(app_control, "org.tizen.app");
658 noti_err = notification_set_event_handler(noti, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, app_control);
659 if(noti_err != NOTIFICATION_ERROR_NONE) {
660 notification_free(noti);
664 app_control_destroy(app_control);
668 int notification_set_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h event_handler);
671 * @brief Gets the event handler of a specific event.
672 * @remarks You must release @a app_control using app_control_destroy().
674 * @param[in] noti The notification handle
675 * @param[in] event_type Launching option type
676 * @param[out] option The pointer of App Control handler
677 * @return #NOTIFICATION_ERROR_NONE on success,
678 * otherwise any other value on failure
679 * @retval #NOTIFICATION_ERROR_NONE Success
680 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
681 * @see #notification_event_type_e
684 #include <notification.h>
687 app_control_h app_control = NULL;
688 app_control_create(&app_control);
692 noti_err = notification_get_event_handler(noti, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, &app_control);
693 if(noti_err != NOTIFICATION_ERROR_NONE) {
694 notification_free(noti);
700 int notification_get_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h *event_handler);
703 * @brief Sets the property of the notification.
704 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
705 * @param[in] noti The notification handle
706 * @param[in] flags The property with | operation
707 * @return #NOTIFICATION_ERROR_NONE on success,
708 * otherwise any other value on failure
709 * @retval #NOTIFICATION_ERROR_NONE Success
710 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
713 #include <notification.h>
716 notification_h noti = NULL;
717 int noti_err = NOTIFICATION_ERROR_NONE;
720 noti = notification_create(NOTIFICATION_TYPE_NOTI);
725 noti_err = notification_set_property(noti, NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE | NOTIFICATION_PROP_DISABLE_APP_LAUNCH);
726 if(noti_err != NOTIFICATION_ERROR_NONE) {
727 notification_free(noti);
733 int notification_set_property(notification_h noti,
737 * @brief Gets the property of the notification from the notification handle.
738 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
739 * @param[in] noti The notification handle
740 * @param[out] flags The notification property
741 * @return #NOTIFICATION_ERROR_NONE on success,
742 * otherwise any other value on failure
743 * @retval #NOTIFICATION_ERROR_NONE Success
744 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
747 #include <notification.h>
750 notification_h noti = NULL;
751 int noti_err = NOTIFICATION_ERROR_NONE;
754 noti_err = notification_get_property(noti, &flags);
755 if(noti_err != NOTIFICATION_ERROR_NONE) {
761 int notification_get_property(notification_h noti,
765 * @brief Sets applications to display the notification.
766 * @details All display application is enable(NOTIFICATION_DISPLAY_APP_ALL) if you are not call this API.
767 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
768 * @param[in] noti The notification handle
769 * @param[in] applist The with | operation
770 * @return #NOTIFICATION_ERROR_NONE on success,
771 * otherwise any other value on failure
772 * @retval #NOTIFICATION_ERROR_NONE Success
773 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
776 #include <notification.h>
779 notification_h noti = NULL;
780 int noti_err = NOTIFICATION_ERROR_NONE;
783 noti = notification_create(NOTIFICATION_TYPE_NOTI);
788 noti_err = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_TICKER | NOTIFICATION_DISPLAY_APP_INDICATOR);
789 if(noti_err != NOTIFICATION_ERROR_NONE) {
790 notification_free(noti);
797 int notification_set_display_applist(notification_h noti,
801 * @brief Gets the application list displaying the notification from the notification handle.
802 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
803 * @param[in] noti The notification handle
804 * @param[out] applist The display application list
805 * @return #NOTIFICATION_ERROR_NONE on success,
806 * otherwise any other value on failure
807 * @retval #NOTIFICATION_ERROR_NONE Success
808 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
811 #include <notification.h>
814 notification_h noti = NULL;
815 int noti_err = NOTIFICATION_ERROR_NONE;
818 noti_err = notification_get_display_applist(noti, &applist);
819 if(noti_err != NOTIFICATION_ERROR_NONE) {
825 int notification_get_display_applist(notification_h noti,
829 * @brief Sets the initial size for the ongoing type.
830 * @details After notification_post() call, the size is not updated.
831 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
832 * @param[in] noti The notification handle
833 * @param[in] size The double type size
834 * @return #NOTIFICATION_ERROR_NONE on success,
835 * otherwise any other value on failure
836 * @retval #NOTIFICATION_ERROR_NONE Success
837 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
840 #include <notification.h>
843 notification_h noti = NULL;
844 int noti_err = NOTIFICATION_ERROR_NONE;
846 noti = notification_create(NOTIFICATION_TYPE_NOTI);
851 noti_err = notification_set_size(noti, 0.0);
852 if(noti_err != NOTIFICATION_ERROR_NONE) {
853 notification_free(noti);
859 int notification_set_size(notification_h noti,
863 * @brief Gets the progress size.
864 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
865 * @param[in] noti The notification handle
866 * @param[out] size The progress size
867 * @return #NOTIFICATION_ERROR_NONE on success,
868 * otherwise any other value on failure
869 * @retval #NOTIFICATION_ERROR_NONE Success
870 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
873 #include <notification.h>
876 notification_h noti = NULL;
877 int noti_err = NOTIFICATION_ERROR_NONE;
880 noti_err = notification_get_size(noti, &size);
881 if(noti_err != NOTIFICATION_ERROR_NONE) {
887 int notification_get_size(notification_h noti,
891 * @brief Sets the initial progress for the ongoing type.
892 * @details After the notification_post() call, the progress is not updated.
893 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
894 * @param[in] noti The notification handle
895 * @param[in] percentage The progress percentage
896 * @return #NOTIFICATION_ERROR_NONE on success,
897 * otherwise any other value on failure
898 * @retval #NOTIFICATION_ERROR_NONE Success
899 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
902 #include <notification.h>
905 notification_h noti = NULL;
906 int noti_err = NOTIFICATION_ERROR_NONE;
908 noti = notification_create(NOTIFICATION_TYPE_NOTI);
913 noti_err = notification_set_progress(noti, 0.0);
914 if(noti_err != NOTIFICATION_ERROR_NONE) {
915 notification_free(noti);
921 int notification_set_progress(notification_h noti,
925 * @brief Gets the progress from the notification handle.
926 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
927 * @remarks At the end of the operation, the progress should be @c 1.0.
928 * @param[in] noti The notification handle
929 * @param[out] percentage The progress percentage
930 * @return #NOTIFICATION_ERROR_NONE on success,
931 * otherwise any other value on failure
932 * @retval #NOTIFICATION_ERROR_NONE Success
933 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
936 #include <notification.h>
939 notification_h noti = NULL;
940 int noti_err = NOTIFICATION_ERROR_NONE;
941 double percentage = 0.0;
943 noti_err = notification_get_progress(noti, &percentage);
944 if(noti_err != NOTIFICATION_ERROR_NONE) {
950 int notification_get_progress(notification_h noti,
954 * @brief Sets the layout of the notification view.
955 * @details Caller can set displaying layout of notification.
956 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
957 * @param[in] noti The notification handle
958 * @param[in] layout The type of layout
959 * @return #NOTIFICATION_ERROR_NONE on success,
960 * otherwise any other value on failure
961 * @retval #NOTIFICATION_ERROR_NONE Success
962 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
963 * @see #notification_ly_type_e
965 int notification_set_layout(notification_h noti,
966 notification_ly_type_e layout);
969 * @brief Gets the layout of the notification view from the notification handle.
970 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
971 * @param[in] noti The notification handle
972 * @param[out] layout The type of layout
973 * @return #NOTIFICATION_ERROR_NONE on success,
974 * otherwise any other value on failure
975 * @retval #NOTIFICATION_ERROR_NONE Success
976 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
977 * @see #notification_ly_type_e
979 int notification_get_layout(notification_h noti,
980 notification_ly_type_e *layout);
983 * @brief Gets the type of a notification.
984 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
985 * @param[in] noti The notification handle
986 * @param[out] type The notification type
987 * @return #NOTIFICATION_ERROR_NONE on success,
988 * otherwise any other value on failure
989 * @retval #NOTIFICATION_ERROR_NONE Success
990 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
993 #include <notification.h>
996 int noti_err = NOTIFICATION_ERROR_NONE;
997 notification_type_e type;
999 noti_err = notification_get_type(noti, &type);
1000 if(noti_err != NOTIFICATION_ERROR_NONE) {
1006 int notification_get_type(notification_h noti,
1007 notification_type_e * type);
1009 * @brief Updates notification data.
1010 * @details The updated notification will appear in the notification area.
1011 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1013 * @privilege %http://tizen.org/privilege/notification
1014 * @param[in] noti The notification handle that is created by notification_create()
1015 * @return #NOTIFICATION_ERROR_NONE on success,
1016 * otherwise any other value on failure
1017 * @retval #NOTIFICATION_ERROR_NONE Success
1018 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1019 * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Priv ID does not exist
1020 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1023 #include <notification.h>
1026 int noti_err = NOTIFICATION_ERROR_NONE;
1028 noti_err = notification_update(NULL);
1029 if(noti_err != NOTIFICATION_ERROR_NONE) {
1035 int notification_update(notification_h noti);
1038 * @brief Deletes a notification with the given handle.
1039 * @details notification_delete() removes notification data from database and notification_free() releases memory of notification data.
1040 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1042 * @privilege %http://tizen.org/privilege/notification
1043 * @param[in] noti The notification handle
1044 * @return #NOTIFICATION_ERROR_NONE on success,
1045 * otherwise any other value on failure
1046 * @retval #NOTIFICATION_ERROR_NONE Success
1047 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1048 * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1051 #include <notification.h>
1054 notificaton_h noti = NULL;
1055 int noti_err = NOTIFICATION_ERROR_NONE;
1059 noti_err = notification_delete(noti);
1060 if(noti_err != NOTIFICATION_ERROR_NONE) {
1067 int notification_delete(notification_h noti);
1070 * @brief Creates internal structure data and returns a notification handle.
1071 * @details Available type is #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING.
1072 * #NOTIFICATION_TYPE_NOTI is remaining notification data even if device is restarted.
1073 * #NOTIFICATION_TYPE_ONGOING can display progress on a notification with #NOTIFICATION_LY_ONGOING_PROGRESS layout.
1074 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1075 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1076 * @param[in] type The notification type
1077 * @return Notification handle(notification_h) on success,
1078 * otherwise @c NULL on failure
1079 * @retval notification_h Success
1080 * @retval NULL Failure
1081 * @exception #NOTIFICATION_ERROR_NONE Success
1082 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1083 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1084 * @see #notification_type_e
1087 #include <notification.h>
1090 notification_h noti = NULL;
1092 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1100 notification_h notification_create(notification_type_e type);
1103 * @brief Creates a notification clone.
1104 * @details Newly created notification handle is returned.
1105 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1106 * @remarks This cloned notification handle should be freed using notification_free().
1107 * @param[in] noti The notification handle
1108 * @param[out] clone The newly created notification handle that has same with input @a noti
1109 * @return #NOTIFICATION_ERROR_NONE if success,
1110 * otherwise any other value if failure
1111 * @retval #NOTIFICATION_ERROR_NONE Success
1112 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1113 * @see #notification_type_e
1116 #include <notification.h>
1119 notification_h noti = notification_create(NOTIFICATION_TYPE_NOTI);
1120 notification_h clone = NULL;
1122 notification_clone(noti, &clone);
1127 int notification_clone(notification_h noti, notification_h *clone);
1130 * @brief Frees the internal structure data of a notification handle.
1131 * @details Internal data of a notification handle is released. Data of the inserted notification is not deleted.
1132 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1133 * @param[in] noti The notification handle
1134 * @return #NOTIFICATION_ERROR_NONE on success,
1135 * otherwise any other value on failure
1136 * @retval #NOTIFICATION_ERROR_NONE Success
1137 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1138 * @pre Notification handle should be created by notification_create().
1141 #include <notification.h>
1144 notification_h noti = NULL;
1145 int noti_err = NOTIFICATION_ERROR_NONE;
1147 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1153 noti_err = notification_free(noti);
1154 if(noti_err != NOTIFICATION_ERROR_NONE) {
1160 int notification_free(notification_h noti);
1167 * @addtogroup NOTIFICATION_MODULE
1172 * @brief Sets the tag of the notification handle.
1173 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1174 * @param[in] noti Notification handle
1175 * @param[in] tag tag for loading notification handle
1176 * @return #NOTIFICATION_ERROR_NONE on success, other value on failure
1177 * @retval #NOTIFICATION_ERROR_NONE Success
1178 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1179 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1180 * @see notification_get_tag()
1183 #include <notification.h>
1186 notification_h noti = NULL;
1187 int noti_err = NOTIFICATION_ERROR_NONE;
1189 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1195 noti_err = notification_set_tag(noti, tag);
1196 if(noti_err != NOTIFICATION_ERROR_NONE) {
1202 int notification_set_tag(notification_h noti, const char *tag);
1205 * @brief Gets the tag of the notification handle.
1206 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1207 * @param[in] noti Notification handle
1208 * @param[out] tag tag for loading notification handle
1209 * @return #NOTIFICATION_ERROR_NONE on success, 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()
1216 #include <notification.h>
1219 int noti_err = NOTIFICATION_ERROR_NONE;
1220 const char *tag = NULL;
1224 noti_err = notification_get_tag(noti, &tag);
1225 if(noti_err != NOTIFICATION_ERROR_NONE) {
1231 int notification_get_tag(notification_h noti, const char **tag);
1234 * @brief Loads a notification from the notification's database with the tag.
1235 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1237 * @privilege %http://tizen.org/privilege/notification
1238 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1239 * @param[in] tag tag for loading notification handle
1240 * @return Notification handle(notification_h) on success, NULL on failure
1241 * @retval notification_h Success
1242 * @retval NULL Failure
1243 * @exception #NOTIFICATION_ERROR_NONE Success
1244 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1245 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1246 * @exception #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1247 * @see #notification_type_e
1250 #include <notification.h>
1253 notification_h noti = NULL;
1255 noti = notification_load_by_tag(tag);
1263 notification_h notification_load_by_tag(const char *tag);
1266 * @brief Deletes all notifications of the given type.
1267 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1269 * @privilege %http://tizen.org/privilege/notification
1270 * @param[in] type Notification type
1271 * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
1272 * @retval #NOTIFICATION_ERROR_NONE Success
1273 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1274 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1277 #include <notification.h>
1280 int noti_err = NOTIFICATION_ERROR_NONE;
1282 noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
1283 if(noti_err != NOTIFICATION_ERROR_NONE) {
1289 int notification_delete_all(notification_type_e type);
1292 * @brief Posts a notification.
1293 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1295 * @privilege %http://tizen.org/privilege/notification
1296 * @param[in] noti Notification handle
1297 * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
1298 * @retval #NOTIFICATION_ERROR_NONE Success
1299 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1300 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1301 * @pre Notification handle should be created by notification_create().
1302 * @post notification_free().
1305 #include <notification.h>
1308 int noti_err = NOTIFICATION_ERROR_NONE;
1310 noti_err = notification_post(noti);
1311 if(noti_err != NOTIFICATION_ERROR_NONE) {
1317 int notification_post(notification_h noti);
1320 * @brief Gets the package name of the notification
1322 * @param[in] noti Notification handle
1323 * @param[out] pkgname The package name of the notification
1324 * @return #NOTIFICATION_ERROR_NONE on success, otherwise a negative error value
1325 * @retval NOTIFICATION_ERROR_NONE Success
1326 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1329 #include <notification.h>
1332 notification_h noti = NULL;
1333 int noti_err = NOTIFICATION_ERROR_NONE;
1334 char *pkgname = NULL;
1338 noti_err = notification_get_pkgname(noti, &pkgname);
1340 if(noti_err != NOTIFICATION_ERROR_NONE) {
1341 notification_free(noti);
1347 int notification_get_pkgname(notification_h noti, char **pkgname);
1350 * @brief Adds a button on the notification
1352 * @param[in] noti Notification handle
1353 * @param[in] button_index Button index
1354 * @return #NOTIFICATION_ERROR_NONE on success, otherwise a negative error value
1355 * @retval NOTIFICATION_ERROR_NONE Success
1356 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1359 #include <notification.h>
1362 notification_h noti = NULL;
1363 int noti_err = NOTIFICATION_ERROR_NONE;
1364 char *pkgname = NULL;
1368 noti_err = notification_add_button(noti, NOTIFICATION_BUTTON_1);
1370 if(noti_err != NOTIFICATION_ERROR_NONE) {
1371 notification_free(noti);
1377 int notification_add_button(notification_h noti, notification_button_index_e button_index);
1380 * @brief Removes a button on the notification
1382 * @param[in] noti Notification handle
1383 * @param[in] button_index Button index
1384 * @return #NOTIFICATION_ERROR_NONE on success, otherwise a negative error value
1385 * @retval NOTIFICATION_ERROR_NONE Success
1386 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1389 #include <notification.h>
1392 notification_h noti = NULL;
1393 int noti_err = NOTIFICATION_ERROR_NONE;
1394 char *pkgname = NULL;
1398 noti_err = notification_remove_button(noti, NOTIFICATION_BUTTON_1);
1400 if(noti_err != NOTIFICATION_ERROR_NONE) {
1401 notification_free(noti);
1407 int notification_remove_button(notification_h noti, notification_button_index_e button_index);
1410 * @brief Sets the 'auto remove' option of the active notification
1411 * @details The 'auto remove' option let the active notification be removed in several seconds after it shows. Default value is true.
1412 * @remarks When 'auto_remove' is set as false, the active notification will not be removed
1413 as long as the user removes the active notification or the app which posted the active notification removes the active notification.
1415 * @param[in] noti Notification handle
1416 * @param[in] auto_remove Auto remove option
1417 * @return #NOTIFICATION_ERROR_NONE On success, other value if failure
1418 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1419 * @see #notification_h
1420 * @see #notification_get_auto_remove
1423 #include <notification.h>
1426 notification_h noti = NULL;
1427 int noti_err = NOTIFICATION_ERROR_NONE;
1431 noti_err = notification_set_auto_remove(noti, false);
1432 if(noti_err != NOTIFICATION_ERROR_NONE) {
1438 int notification_set_auto_remove(notification_h noti, bool auto_remove);
1441 * @brief Gets the 'auto remove' option of the active notification
1442 * @details The 'auto remove' option let the active notification be removed in several seconds after it shows. Default value is true.
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
1452 #include <notification.h>
1455 int noti_err = NOTIFICATION_ERROR_NONE;
1460 noti_err = notification_get_auto_remove(noti, &auto_remove);
1461 if(noti_err != NOTIFICATION_ERROR_NONE) {
1467 int notification_get_auto_remove(notification_h noti, bool *auto_remove);
1476 #endif /* __NOTIFICATION_H__ */