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_list.h>
32 #include <notification_status.h>
39 * @file notification.h
40 * @brief This file contains the notification API.
44 * @addtogroup NOTIFICATION_MODULE
49 * @brief Sets an absolute path for an image file to display on the notification view.
51 * @param[in] noti The notification handle
52 * @param[in] type The notification image type
53 * @param[in] image_path The image file full path
54 * @return #NOTIFICATION_ERROR_NONE on success,
55 * otherwise any other value on failure
56 * @retval #NOTIFICATION_ERROR_NONE Success
57 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
58 * @pre Notification handle should be created by notification_create().
59 * @see #notification_image_type_e
60 * @see notification_create()
63 #include <notification.h>
66 notification_h noti = NULL;
67 int noti_err = NOTIFICATION_ERROR_NONE;
69 noti = notification_create(NOTIFICATION_TYPE_NOTI);
74 noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, APP_IMAGE_FULL_PATH);
75 if(noti_err != NOTIFICATION_ERROR_NONE) {
76 notification_free(noti);
82 int notification_set_image(notification_h noti,
83 notification_image_type_e type,
84 const char *image_path);
87 * @brief Gets the absolute path of an image file.
89 * @remarks Do not free @a image_path. It will be freed when notification_free() is called.
90 * @param[in] noti Notification handle
91 * @param[in] type Notification image type
92 * @param[out] image_path image file full path
93 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
94 * @retval NOTIFICATION_ERROR_NONE Success
95 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
96 * @pre Notification handle should be created by notification_create().
97 * @see #notification_image_type_e
98 * @see notification_create()
101 #include <notification.h>
104 char *image_path = NULL;
105 int noti_err = NOTIFICATION_ERROR_NONE;
107 noti_err = notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, &image_path);
108 if(noti_err != NOTIFICATION_ERROR_NONE) {
114 int notification_get_image(notification_h noti,
115 notification_image_type_e type,
119 * @brief Sets a timestamp.
120 * @details If input_time is @c 0, time information is taken from the current time.
122 * @param[in] noti The notification handle
123 * @param[in] input_time The input time
124 * @return #NOTIFICATION_ERROR_NONE on success,
125 * otherwise any other value on failure
126 * @retval #NOTIFICATION_ERROR_NONE Success
127 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
128 * @pre Notification handle should be created by notification_create().
129 * @see notification_create()
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.
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.
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.
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.
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.
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.
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,
325 * @brief Sets the sound type for the notification.
327 * @param[in] noti The notification handle
328 * @param[in] type The notification sound type
329 * @param[in] path The user sound file path
330 * @return #NOTIFICATION_ERROR_NONE on success,
331 * otherwise any other value on failure
332 * @retval #NOTIFICATION_ERROR_NONE Success
333 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
336 #include <notification.h>
339 notification_h noti = NULL;
340 int noti_err = NOTIFICATION_ERROR_NONE;
342 noti_err = notification_set_sound(noti, NOTIFICATION_SOUND_TYPE_DEFAULT, NULL);
343 if(noti_err != NOTIFICATION_ERROR_NONE) {
349 int notification_set_sound(notification_h noti,
350 notification_sound_type_e type,
354 * @brief Gets the sound type from the notification handle.
356 * @param[in] noti The notification handle
357 * @param[out] type The notification sound type
358 * @param[out] path The user sound file path
359 * @return #NOTIFICATION_ERROR_NONE on success,
360 * otherwise any other value on failure
361 * @retval #NOTIFICATION_ERROR_NONE Success
362 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
365 #include <notification.h>
368 notification_h noti = NULL;
369 int noti_err = NOTIFICATION_ERROR_NONE;
370 notification_sound_type_e type = NOTIFICATION_SOUND_TYPE_NONE;
372 noti_err = notification_get_sound(noti, &type, NULL);
373 if(noti_err != NOTIFICATION_ERROR_NONE) {
379 int notification_get_sound(notification_h noti,
380 notification_sound_type_e *type,
384 * @brief Sets the vibration type for the notification.
386 * @param[in] noti The notification handle
387 * @param[in] type The notification vibration type
388 * @param[in] path The user vibration file path
389 * @return #NOTIFICATION_ERROR_NONE on success,
390 * otherwise any other value on failure
391 * @retval #NOTIFICATION_ERROR_NONE Success
392 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
395 #include <notification.h>
398 notification_h noti = NULL;
399 int noti_err = NOTIFICATION_ERROR_NONE;
401 noti_err = notification_set_vibration(noti, NOTIFICATION_VIBRATION_TYPE_DEFAULT, NULL);
402 if(noti_err != NOTIFICATION_ERROR_NONE) {
408 int notification_set_vibration(notification_h noti,
409 notification_vibration_type_e type,
413 * @brief Gets the vibrate type from the notification handle.
415 * @param[in] noti The notification handle
416 * @param[out] type The notification sound type
417 * @param[out] path The user vibration file path
418 * @return #NOTIFICATION_ERROR_NONE on success,
419 * otherwise other value on failure
420 * @retval #NOTIFICATION_ERROR_NONE Success
421 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
424 #include <notification.h>
427 notification_h noti = NULL;
428 int noti_err = NOTIFICATION_ERROR_NONE;
429 notification_vibration_type_e type = NOTIFICATION_VIBRATION_TYPE_NONE;
431 noti_err = notification_get_vibration(noti, &type, NULL);
432 if(noti_err != NOTIFICATION_ERROR_NONE) {
438 int notification_get_vibration(notification_h noti,
439 notification_vibration_type_e *type,
443 * @brief Sets the LED displaying option.
445 * @param[in] noti The notification handle
446 * @param[in] operation The LED notification operation
447 * @param[in] led_argb The notification led color
448 * @return #NOTIFICATION_ERROR_NONE on success,
449 * otherwise other value on failure
450 * @retval #NOTIFICATION_ERROR_NONE Success
451 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
454 #include <notification.h>
457 notification_h noti = NULL;
458 int noti_err = NOTIFICATION_ERROR_NONE;
460 noti_err = notification_set_led(noti, NOTIFICATION_LED_TYPE_DEFAULT, NULL);
461 if(noti_err != NOTIFICATION_ERROR_NONE) {
467 int notification_set_led(notification_h noti,
468 notification_led_op_e operation,
472 * @brief Gets the LED displaying option from the notification handle.
474 * @param[in] noti The notification handle
475 * @param[out] operation The LED notification operation
476 * @param[out] led_argb The notification LED color
477 * @return #NOTIFICATION_ERROR_NONE on success,
478 * otherwise any other value on failure
479 * @retval #NOTIFICATION_ERROR_NONE Success
480 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
483 #include <notification.h>
486 notification_h noti = NULL;
487 int noti_err = NOTIFICATION_ERROR_NONE;
488 notification_led_type_e type = NOTIFICATION_LED_TYPE_NONE;
490 noti_err = notification_get_led(noti, &type, NULL);
491 if(noti_err != NOTIFICATION_ERROR_NONE) {
497 int notification_get_led(notification_h noti,
498 notification_led_op_e *operation,
502 * @brief Sets the time period of flashing the LED.
504 * @param[in] noti The notification handle
505 * @param[in] on_ms The time for turning on the LED
506 * @param[in] off_ms The time for turning off the LED
507 * @return #NOTIFICATION_ERROR_NONE on success,
508 * otherwise any other value on failure
509 * @retval #NOTIFICATION_ERROR_NONE Success
510 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
513 #include <notification.h>
516 notification_h noti = NULL;
517 int noti_err = NOTIFICATION_ERROR_NONE;
519 noti_err = notification_set_led_time_period(noti, 100, 100);
520 if(noti_err != NOTIFICATION_ERROR_NONE) {
526 int notification_set_led_time_period(notification_h noti,
527 int on_ms, int off_ms);
530 * @brief Gets the time period of flashing the LED from the notification handle.
532 * @param[in] noti The notification handle
533 * @param[out] on_ms The time for turning on the LED
534 * @param[out] off_ms The time for turning on the LED
535 * @return #NOTIFICATION_ERROR_NONE on success,
536 * otherwise any other value on failure
537 * @retval #NOTIFICATION_ERROR_NONE Success
538 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
541 #include <notification.h>
544 notification_h noti = NULL;
545 int noti_err = NOTIFICATION_ERROR_NONE;
549 noti_err = notification_get_led_time_period(noti, &led_on_ms, &led_off_ms);
550 if(noti_err != NOTIFICATION_ERROR_NONE) {
556 int notification_get_led_time_period(notification_h noti,
557 int *on_ms, int *off_ms);
560 * @brief Sets the launch option for a notification.
561 * @details When notification data selected in display application, application launched by app_control_send_launch_request with app_control handle.
563 * @param[in] noti The notification handle
564 * @param[in] type Launching option type
565 * @param[in] option App Control handler
566 * @return #NOTIFICATION_ERROR_NONE on success,
567 * otherwise any other value on failure
568 * @retval #NOTIFICATION_ERROR_NONE Success
569 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
572 #include <notification.h>
575 notification_h noti = NULL;
576 app_control_h app_control = NULL;
577 int noti_err = NOTIFICATION_ERROR_NONE;
581 app_control_create(&app_control);
582 app_control_set_app_id(app_control, "org.tizen.app");
586 noti_err = notification_set_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)app_control);
587 if(noti_err != NOTIFICATION_ERROR_NONE) {
588 notification_free(noti);
592 app_control_destroy(app_control);
596 int notification_set_launch_option(notification_h noti,
597 notification_launch_option_type type, void *option);
600 * @brief Gets the launch option from the notification handle.
602 * @remarks You must release @a app_control using app_control_destroy().
603 * @param[in] noti The notification handle
604 * @param[in] type Launching option type
605 * @param[out] option The pointer of App Control handler
606 * @return #NOTIFICATION_ERROR_NONE on success,
607 * otherwise any other value on failure
608 * @retval #NOTIFICATION_ERROR_NONE Success
609 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
612 #include <notification.h>
615 app_control_h app_control = NULL;
616 app_control_create(&app_control);
620 noti_err = notification_get_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)&app_control);
621 if(noti_err != NOTIFICATION_ERROR_NONE) {
622 notification_free(noti);
628 int notification_get_launch_option(notification_h noti,
629 notification_launch_option_type type, void *option);
632 * @brief Sets the handler for a specific event.
633 * @details When some event occurs on notification, application launched by app_control_send_launch_request with app_control handle.\n
634 * Setting event handler of a button means that the notification will show the button.
636 * @param[in] noti The notification handle
637 * @param[in] event_type event type
638 * @param[in] event_handler app control handle
639 * @return #NOTIFICATION_ERROR_NONE on success,
640 * otherwise any other value on failure
641 * @retval #NOTIFICATION_ERROR_NONE Success
642 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
643 * @see #notification_event_type_e
646 #include <notification.h>
649 notification_h noti = NULL;
650 app_control_h app_control = NULL;
651 int noti_err = NOTIFICATION_ERROR_NONE;
655 app_control_create(&app_control);
656 app_control_set_app_id(app_control, "org.tizen.app");
660 noti_err = notification_set_event_handler(noti, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, app_control);
661 if(noti_err != NOTIFICATION_ERROR_NONE) {
662 notification_free(noti);
666 app_control_destroy(app_control);
670 int notification_set_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h event_handler);
673 * @brief Gets the event handler of a specific event.
674 * @remarks You must release @a app_control using app_control_destroy().
676 * @param[in] noti The notification handle
677 * @param[in] event_type Launching option type
678 * @param[out] option The pointer of App Control handler
679 * @return #NOTIFICATION_ERROR_NONE on success,
680 * otherwise any other value on failure
681 * @retval #NOTIFICATION_ERROR_NONE Success
682 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
683 * @see #notification_event_type_e
686 #include <notification.h>
689 app_control_h app_control = NULL;
690 app_control_create(&app_control);
694 noti_err = notification_get_event_handler(noti, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, &app_control);
695 if(noti_err != NOTIFICATION_ERROR_NONE) {
696 notification_free(noti);
702 int notification_get_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h *event_handler);
705 * @brief Sets the property of the notification.
707 * @param[in] noti The notification handle
708 * @param[in] flags The property with | operation
709 * @return #NOTIFICATION_ERROR_NONE on success,
710 * otherwise any other value on failure
711 * @retval #NOTIFICATION_ERROR_NONE Success
712 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
715 #include <notification.h>
718 notification_h noti = NULL;
719 int noti_err = NOTIFICATION_ERROR_NONE;
722 noti = notification_create(NOTIFICATION_TYPE_NOTI);
727 noti_err = notification_set_property(noti, NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE | NOTIFICATION_PROP_DISABLE_APP_LAUNCH);
728 if(noti_err != NOTIFICATION_ERROR_NONE) {
729 notification_free(noti);
735 int notification_set_property(notification_h noti,
739 * @brief Gets the property of the notification from the notification handle.
741 * @param[in] noti The notification handle
742 * @param[out] flags The notification property
743 * @return #NOTIFICATION_ERROR_NONE on success,
744 * otherwise any other value on failure
745 * @retval #NOTIFICATION_ERROR_NONE Success
746 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
749 #include <notification.h>
752 notification_h noti = NULL;
753 int noti_err = NOTIFICATION_ERROR_NONE;
756 noti_err = notification_get_property(noti, &flags);
757 if(noti_err != NOTIFICATION_ERROR_NONE) {
763 int notification_get_property(notification_h noti,
767 * @brief Sets applications to display the notification.
768 * @details All display application is enable(NOTIFICATION_DISPLAY_APP_ALL) if you are not call this API.
770 * @param[in] noti The notification handle
771 * @param[in] applist The with | operation
772 * @return #NOTIFICATION_ERROR_NONE on success,
773 * otherwise any other value on failure
774 * @retval #NOTIFICATION_ERROR_NONE Success
775 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
778 #include <notification.h>
781 notification_h noti = NULL;
782 int noti_err = NOTIFICATION_ERROR_NONE;
785 noti = notification_create(NOTIFICATION_TYPE_NOTI);
790 noti_err = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_TICKER | NOTIFICATION_DISPLAY_APP_INDICATOR);
791 if(noti_err != NOTIFICATION_ERROR_NONE) {
792 notification_free(noti);
799 int notification_set_display_applist(notification_h noti,
803 * @brief Gets the application list displaying the notification from the notification handle.
805 * @param[in] noti The notification handle
806 * @param[out] applist The display application list
807 * @return #NOTIFICATION_ERROR_NONE on success,
808 * otherwise any other value on failure
809 * @retval #NOTIFICATION_ERROR_NONE Success
810 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
813 #include <notification.h>
816 notification_h noti = NULL;
817 int noti_err = NOTIFICATION_ERROR_NONE;
820 noti_err = notification_get_display_applist(noti, &applist);
821 if(noti_err != NOTIFICATION_ERROR_NONE) {
827 int notification_get_display_applist(notification_h noti,
831 * @brief Sets the initial size for the ongoing type.
832 * @details After notification_post() call, the size is not updated.
834 * @param[in] noti The notification handle
835 * @param[in] size The double type size
836 * @return #NOTIFICATION_ERROR_NONE on success,
837 * otherwise any other value on failure
838 * @retval #NOTIFICATION_ERROR_NONE Success
839 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
842 #include <notification.h>
845 notification_h noti = NULL;
846 int noti_err = NOTIFICATION_ERROR_NONE;
848 noti = notification_create(NOTIFICATION_TYPE_NOTI);
853 noti_err = notification_set_size(noti, 0.0);
854 if(noti_err != NOTIFICATION_ERROR_NONE) {
855 notification_free(noti);
861 int notification_set_size(notification_h noti,
865 * @brief Gets the progress size.
867 * @param[in] noti The notification handle
868 * @param[out] size The progress size
869 * @return #NOTIFICATION_ERROR_NONE on success,
870 * otherwise any other value on failure
871 * @retval #NOTIFICATION_ERROR_NONE Success
872 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
875 #include <notification.h>
878 notification_h noti = NULL;
879 int noti_err = NOTIFICATION_ERROR_NONE;
882 noti_err = notification_get_size(noti, &size);
883 if(noti_err != NOTIFICATION_ERROR_NONE) {
889 int notification_get_size(notification_h noti,
893 * @brief Sets the initial progress for the ongoing type.
894 * @details After the notification_post() call, the progress is not updated.
896 * @param[in] noti The notification handle
897 * @param[in] percentage The progress percentage
898 * @return #NOTIFICATION_ERROR_NONE on success,
899 * otherwise any other value on failure
900 * @retval #NOTIFICATION_ERROR_NONE Success
901 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
904 #include <notification.h>
907 notification_h noti = NULL;
908 int noti_err = NOTIFICATION_ERROR_NONE;
910 noti = notification_create(NOTIFICATION_TYPE_NOTI);
915 noti_err = notification_set_progress(noti, 0.0);
916 if(noti_err != NOTIFICATION_ERROR_NONE) {
917 notification_free(noti);
923 int notification_set_progress(notification_h noti,
927 * @brief Gets the progress from the notification handle.
929 * @remarks At the end of the operation, the progress should be @c 1.0.
930 * @param[in] noti The notification handle
931 * @param[out] percentage The progress percentage
932 * @return #NOTIFICATION_ERROR_NONE on success,
933 * otherwise any other value on failure
934 * @retval #NOTIFICATION_ERROR_NONE Success
935 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
938 #include <notification.h>
941 notification_h noti = NULL;
942 int noti_err = NOTIFICATION_ERROR_NONE;
943 double percentage = 0.0;
945 noti_err = notification_get_progress(noti, &percentage);
946 if(noti_err != NOTIFICATION_ERROR_NONE) {
952 int notification_get_progress(notification_h noti,
956 * @brief Sets the layout of the notification view.
957 * @details Caller can set displaying layout of notification.
959 * @param[in] noti The notification handle
960 * @param[in] layout The type of layout
961 * @return #NOTIFICATION_ERROR_NONE on success,
962 * otherwise any other value on failure
963 * @retval #NOTIFICATION_ERROR_NONE Success
964 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
965 * @see #notification_ly_type_e
967 int notification_set_layout(notification_h noti,
968 notification_ly_type_e layout);
971 * @brief Gets the layout of the notification view from the notification handle.
973 * @param[in] noti The notification handle
974 * @param[out] layout The type of layout
975 * @return #NOTIFICATION_ERROR_NONE on success,
976 * otherwise any other value on failure
977 * @retval #NOTIFICATION_ERROR_NONE Success
978 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
979 * @see #notification_ly_type_e
981 int notification_get_layout(notification_h noti,
982 notification_ly_type_e *layout);
985 * @brief Gets the type of a notification.
987 * @param[in] noti The notification handle
988 * @param[out] type The notification type
989 * @return #NOTIFICATION_ERROR_NONE on success,
990 * otherwise any other value on failure
991 * @retval #NOTIFICATION_ERROR_NONE Success
992 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
995 #include <notification.h>
998 int noti_err = NOTIFICATION_ERROR_NONE;
999 notification_type_e type;
1001 noti_err = notification_get_type(noti, &type);
1002 if(noti_err != NOTIFICATION_ERROR_NONE) {
1008 int notification_get_type(notification_h noti,
1009 notification_type_e * type);
1013 * @brief Inserts a notification.
1014 * @details The notification will be inserted to the database and then it will appear in the notification area.
1015 * When notification_create() is called, if priv_id is #NOTIFICATION_PRIV_ID_NONE, priv_id returns the internally set priv_id.
1018 * @privilege %http://tizen.org/privilege/notification
1019 * @param[in] noti The notification handle
1020 * @param[out] priv_id The private ID
1021 * @return #NOTIFICATION_ERROR_NONE on success,
1022 * otherwise any other value on failure
1023 * @retval #NOTIFICATION_ERROR_NONE Success
1024 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1025 * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1026 * @pre Notification handle should be created by notification_create().
1027 * @post notification_free().
1030 #include <notification.h>
1033 int noti_err = NOTIFICATION_ERROR_NONE;
1035 noti_err = notification_insert(noti, NULL);
1036 if(noti_err != NOTIFICATION_ERROR_NONE) {
1042 int notification_insert(notification_h noti,
1046 * @brief Updates notification data.
1047 * @details The updated notification will appear in the notification area.
1050 * @privilege %http://tizen.org/privilege/notification
1051 * @param[in] noti The notification handle that is created by notification_create()
1052 * @return #NOTIFICATION_ERROR_NONE on success,
1053 * otherwise any other value on failure
1054 * @retval #NOTIFICATION_ERROR_NONE Success
1055 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1056 * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Priv ID does not exist
1057 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1060 #include <notification.h>
1063 int noti_err = NOTIFICATION_ERROR_NONE;
1065 noti_err = notification_update(NULL);
1066 if(noti_err != NOTIFICATION_ERROR_NONE) {
1072 int notification_update(notification_h noti);
1076 * @brief Updates a notification, asynchronously.
1077 * @details The updated notification will appear in the notification area.
1080 * @privilege %http://tizen.org/privilege/notification
1081 * @remarks This function updates the notification asynchronously.
1082 * @param[in] noti The notification handle that is created by notification_create()
1083 * @param[in] result_cb The callback called when an update completed
1084 * @param[in] user_data The user data which you want to use in callback
1085 * @return #NOTIFICATION_ERROR_NONE on success,
1086 * otherwise any other value on failure
1087 * @retval #NOTIFICATION_ERROR_NONE Success
1088 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1089 * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Priv ID does not exist
1090 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1093 #include <notification.h>
1096 int noti_err = NOTIFICATION_ERROR_NONE;
1098 noti_err = notification_update_async(NULL, result_cb, data);
1099 if(noti_err != NOTIFICATION_ERROR_NONE) {
1105 int notification_update_async(notification_h noti,
1106 void (*result_cb)(int priv_id, int result, void *data), void *user_data);
1109 * @brief Deletes a notification with the given handle.
1110 * @details notification_delete() removes notification data from database and notification_free() releases memory of notification data.
1113 * @privilege %http://tizen.org/privilege/notification
1114 * @param[in] noti The notification handle
1115 * @return #NOTIFICATION_ERROR_NONE on success,
1116 * otherwise any other value on failure
1117 * @retval #NOTIFICATION_ERROR_NONE Success
1118 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1119 * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1122 #include <notification.h>
1125 notificaton_h noti = NULL;
1126 int noti_err = NOTIFICATION_ERROR_NONE;
1130 noti_err = notification_delete(noti);
1131 if(noti_err != NOTIFICATION_ERROR_NONE) {
1138 int notification_delete(notification_h noti);
1141 * @brief Creates internal structure data and returns a notification handle.
1142 * @details Available type is #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING.
1143 * #NOTIFICATION_TYPE_NOTI is remaining notification data even if device is restarted.
1144 * #NOTIFICATION_TYPE_ONGOING can display progressive feather, but notification data is removed after device is restarted.
1146 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1147 * @param[in] type The notification type
1148 * @return Notification handle(notification_h) on success,
1149 * otherwise @c NULL on failure
1150 * @retval notification_h Success
1151 * @retval NULL Failure
1152 * @exception #NOTIFICATION_ERROR_NONE Success
1153 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1154 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1155 * @see #notification_type_e
1158 #include <notification.h>
1161 notification_h noti = NULL;
1163 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1171 notification_h notification_create(notification_type_e type);
1174 * @brief Creates a notification clone.
1175 * @details Newly created notification handle is returned.
1177 * @remarks This cloned notification handle should be freed using notification_free().
1178 * @param[in] noti The notification handle
1179 * @param[out] clone The newly created notification handle that has same with input @a noti
1180 * @return #NOTIFICATION_ERROR_NONE if success,
1181 * otherwise any other value if failure
1182 * @retval #NOTIFICATION_ERROR_NONE Success
1183 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1184 * @see #notification_type_e
1187 #include <notification.h>
1190 notification_h noti = notification_create(NOTIFICATION_TYPE_NOTI);
1191 notification_h clone = NULL;
1193 notification_clone(noti, &clone);
1198 int notification_clone(notification_h noti, notification_h *clone);
1201 * @brief Frees the internal structure data of a notification handle.
1202 * @details Internal data of a notification handle is released. Data of the inserted notification is not deleted.
1204 * @param[in] noti The notification handle
1205 * @return #NOTIFICATION_ERROR_NONE on success,
1206 * otherwise any other value on failure
1207 * @retval #NOTIFICATION_ERROR_NONE Success
1208 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1209 * @pre Notification handle should be created by notification_create().
1212 #include <notification.h>
1215 notification_h noti = NULL;
1216 int noti_err = NOTIFICATION_ERROR_NONE;
1218 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1224 noti_err = notification_free(noti);
1225 if(noti_err != NOTIFICATION_ERROR_NONE) {
1231 int notification_free(notification_h noti);
1239 * @addtogroup NOTIFICATION_LIST
1245 * @brief Returns the notification list handle.
1246 * @details If count is equal to @c -1, all notifications are returned.
1249 * @privilege %http://tizen.org/privilege/notification
1250 * @param[in] type The notification type
1251 * @param[in] count The returned notification data number
1252 * @param[out] #NOTIFICATION_ERROR_NONE on success, other value on failure
1253 * @return #NOTIFICATION_ERROR_NONE on success,
1254 * otherwise any other value on failure
1255 * @retval #NOTIFICATION_ERROR_NONE Success
1256 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1257 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1258 * @see #notification_list_h
1261 #include <notification.h>
1264 notification_list_h noti_list = NULL;
1265 int noti_err = NOTIFICATION_ERROR_NONE;
1267 noti_err = notification_get_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list);
1268 if(noti_err != NOTIFICATION_ERROR_NONE) {
1274 int notification_get_list(notification_type_e type,
1276 notification_list_h * list);
1280 * @brief Returns the notification detail list handle of grouping data.
1281 * @details If count is equal to c -1, all notifications are returned.
1284 * @privilege %http://tizen.org/privilege/notification
1285 * @param[in] pkgname The caller application package name
1286 * @param[in] group_id The group ID
1287 * @param[in] priv_id The private ID
1288 * @param[in] count The returned notification data number
1289 * @param[out] list The notification list handle
1290 * @return #NOTIFICATION_ERROR_NONE if success,
1291 * other value if failure
1292 * @retval #NOTIFICATION_ERROR_NONE Success
1293 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1294 * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1295 * @see #notification_list_h
1298 #include <notification.h>
1301 notification_list_h noti_list = NULL;
1302 int noti_err = NOTIFICATION_ERROR_NONE;
1304 noti_err = notification_get_detail_list(pkgname, group_id, priv_id, -1, ¬i_list);
1305 if(noti_err != NOTIFICATION_ERROR_NONE) {
1311 int notification_get_detail_list(const char *pkgname,
1315 notification_list_h *list);
1319 * @brief Frees a notification list.
1322 * @privilege %http://tizen.org/privilege/notification
1323 * @param[in] list The notification list handle
1324 * @return #NOTIFICATION_ERROR_NONE on success,
1325 * otherwise any other value on failure
1326 * @retval #NOTIFICATION_ERROR_NONE Success
1327 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1328 * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1329 * @pre notification_get_grouping_list() or notification_get_detail_list().
1330 * @see #notification_list_h
1333 #include <notification.h>
1336 notification_list_h noti_list = NULL;
1337 int noti_err = NOTIFICATION_ERROR_NONE;
1341 noti_err = notification_free_list(noti_list);
1342 if(noti_err != NOTIFICATION_ERROR_NONE) {
1348 int notification_free_list(notification_list_h list);
1355 * @addtogroup NOTIFICATION_MODULE
1361 * @brief Registers a callback for all notification events.
1362 * @details The registered callback could be called for all notification events.
1365 * @privilege %http://tizen.org/privilege/notification
1366 * @param[in] changed_cb The callback function
1367 * @param[in] user_data The user data
1368 * @return #NOTIFICATION_ERROR_NONE on success,
1369 * otherwise any other value on failure
1370 * @retval #NOTIFICATION_ERROR_NONE Success
1371 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1372 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1373 * @see notification_unregister_detailed_changed_cb()
1376 #include <notification.h>
1379 noti_err = notification_register_detailed_changed_cb(app_changed_cb, user_data);
1380 if(noti_err != NOTIFICATION_ERROR_NONE) {
1386 int notification_register_detailed_changed_cb(
1387 void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
1392 * @brief Unregisters a callback for all notification events.
1395 * @privilege %http://tizen.org/privilege/notification
1396 * @param[in] changed_cb The callback function
1397 * @return #NOTIFICATION_ERROR_NONE on success,
1398 * otherwise any other value on failure
1399 * @retval #NOTIFICATION_ERROR_NONE Success
1400 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1401 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1402 * @see notification_register_detailed_changed_cb()
1405 #include <notification.h>
1408 noti_err = notification_register_detailed_changed_cb(app_changed_cb, user_data);
1409 if(noti_err != NOTIFICATION_ERROR_NONE) {
1415 int notification_unregister_detailed_changed_cb(
1416 void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
1420 * @brief Sets the tag of the notification handle.
1422 * @param[in] noti Notification handle
1423 * @param[in] tag tag for loading notification handle
1424 * @return #NOTIFICATION_ERROR_NONE on success, other value on failure
1425 * @retval #NOTIFICATION_ERROR_NONE Success
1426 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1427 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1428 * @see notification_get_tag()
1431 #include <notification.h>
1434 notification_h noti = NULL;
1435 int noti_err = NOTIFICATION_ERROR_NONE;
1437 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1443 noti_err = notification_set_tag(noti, tag);
1444 if(noti_err != NOTIFICATION_ERROR_NONE) {
1450 int notification_set_tag(notification_h noti, const char *tag);
1453 * @brief Gets the tag of the notification handle.
1455 * @param[in] noti Notification handle
1456 * @param[out] tag tag for loading notification handle
1457 * @return #NOTIFICATION_ERROR_NONE on success, other value on failure
1458 * @retval #NOTIFICATION_ERROR_NONE Success
1459 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1460 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1461 * @see notification_set_tag()
1464 #include <notification.h>
1467 int noti_err = NOTIFICATION_ERROR_NONE;
1468 const char *tag = NULL;
1472 noti_err = notification_get_tag(noti, &tag);
1473 if(noti_err != NOTIFICATION_ERROR_NONE) {
1479 int notification_get_tag(notification_h noti, const char **tag);
1483 * @brief Gets the package name of the notification
1484 * @remarks The pkgname must be released using free()
1487 * @param[in] noti Notification handle
1488 * @param[out] pkgname package name of the notification
1489 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
1490 * @retval NOTIFICATION_ERROR_NONE Success
1491 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1494 #include <notification.h>
1497 notification_h noti = NULL;
1498 int noti_err = NOTIFICATION_ERROR_NONE;
1499 char *pkgname = NULL;
1501 noti_err = notification_get_pkgname(noti, &pkgname);
1502 if(noti_err != NOTIFICATION_ERROR_NONE) {
1508 int notification_get_pkgname(notification_h noti, char **pkgname);
1511 * @brief Loads a notification from the notification's database with the tag.
1514 * @privilege %http://tizen.org/privilege/notification
1515 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1516 * @param[in] tag tag for loading notification handle
1517 * @return Notification handle(notification_h) on success, NULL on failure
1518 * @retval notification_h Success
1519 * @retval NULL Failure
1520 * @exception #NOTIFICATION_ERROR_NONE Success
1521 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1522 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1523 * @exception #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1524 * @see #notification_type_e
1527 #include <notification.h>
1530 notification_h noti = NULL;
1532 noti = notification_load_by_tag(tag);
1540 notification_h notification_load_by_tag(const char *tag);
1543 * @brief Deletes all notifications of the given type.
1546 * @privilege %http://tizen.org/privilege/notification
1547 * @param[in] type Notification type
1548 * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
1549 * @retval #NOTIFICATION_ERROR_NONE Success
1550 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1551 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1554 #include <notification.h>
1557 int noti_err = NOTIFICATION_ERROR_NONE;
1559 noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
1560 if(noti_err != NOTIFICATION_ERROR_NONE) {
1566 int notification_delete_all(notification_type_e type);
1569 * @brief Posts a notification.
1572 * @privilege %http://tizen.org/privilege/notification
1573 * @param[in] noti Notification handle
1574 * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
1575 * @retval #NOTIFICATION_ERROR_NONE Success
1576 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1577 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1578 * @pre Notification handle should be created by notification_create().
1579 * @post notification_free().
1582 #include <notification.h>
1585 int noti_err = NOTIFICATION_ERROR_NONE;
1587 noti_err = notification_post(noti);
1588 if(noti_err != NOTIFICATION_ERROR_NONE) {
1594 int notification_post(notification_h noti);
1597 * @brief Sets permissions to application for updating or deletin the notification
1600 * @privilege %http://tizen.org/privilege/notification
1601 * @param[in] noti Notification handle
1602 * @param[in] permission_type permission type
1603 * @param[in] app_id target application id
1604 * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
1605 * @retval #NOTIFICATION_ERROR_NONE Success
1606 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1607 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1608 * @see #notification_get_permission
1609 * @see #notification_permission_type_e
1610 * @see #notification_h
1613 #include <notification.h>
1616 notification_h noti = NULL;
1617 int noti_err = NOTIFICATION_ERROR_NONE;
1619 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1625 noti_err = notification_set_permission(noti, NOTIFICATION_PERMISSION_TYPE_DELETE, "org.tizen.xxx");
1626 if(noti_err != NOTIFICATION_ERROR_NONE) {
1632 int notification_set_permission(notification_h handle, notification_permission_type_e permission_type, const char *app_id);
1635 * @brief Gets permissions of the notification
1636 * @remarks app_id must not be freed. This will be free with notification_free.
1639 * @privilege %http://tizen.org/privilege/notification
1640 * @param[in] noti Notification handle
1641 * @param[out] permission_type permission type
1642 * @param[out] app_id target application id
1643 * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
1644 * @retval #NOTIFICATION_ERROR_NONE Success
1645 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1646 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1647 * @see #notification_set_permission
1648 * @see #notification_permission_type_e
1649 * @see #notification_h
1652 #include <notification.h>
1655 int noti_err = NOTIFICATION_ERROR_NONE;
1656 notification_permission_type_e permission_type;
1657 const char *app_id = NULL;
1661 noti_err = notification_get_permission(noti, &permission_type, &app_id);
1662 if(noti_err != NOTIFICATION_ERROR_NONE) {
1668 int notification_get_permission(notification_h handle, notification_permission_type_e *permission_type, const char **app_id);
1678 #endif /* __NOTIFICATION_H__ */