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);
1011 * @brief Updates notification data.
1012 * @details The updated notification will appear in the notification area.
1015 * @privilege %http://tizen.org/privilege/notification
1016 * @param[in] noti The notification handle that is created by notification_create()
1017 * @return #NOTIFICATION_ERROR_NONE on success,
1018 * otherwise any other value on failure
1019 * @retval #NOTIFICATION_ERROR_NONE Success
1020 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1021 * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Priv ID does not exist
1022 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1025 #include <notification.h>
1028 int noti_err = NOTIFICATION_ERROR_NONE;
1030 noti_err = notification_update(NULL);
1031 if(noti_err != NOTIFICATION_ERROR_NONE) {
1037 int notification_update(notification_h noti);
1040 * @brief Deletes a notification with the given handle.
1041 * @details notification_delete() removes notification data from database and notification_free() releases memory of notification data.
1044 * @privilege %http://tizen.org/privilege/notification
1045 * @param[in] noti The notification handle
1046 * @return #NOTIFICATION_ERROR_NONE on success,
1047 * otherwise any other value on failure
1048 * @retval #NOTIFICATION_ERROR_NONE Success
1049 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1050 * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1053 #include <notification.h>
1056 notificaton_h noti = NULL;
1057 int noti_err = NOTIFICATION_ERROR_NONE;
1061 noti_err = notification_delete(noti);
1062 if(noti_err != NOTIFICATION_ERROR_NONE) {
1069 int notification_delete(notification_h noti);
1072 * @brief Creates internal structure data and returns a notification handle.
1073 * @details Available type is #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING.
1074 * #NOTIFICATION_TYPE_NOTI is remaining notification data even if device is restarted.
1075 * #NOTIFICATION_TYPE_ONGOING can display progressive feather, but notification data is removed after device is restarted.
1077 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1078 * @param[in] type The notification type
1079 * @return Notification handle(notification_h) on success,
1080 * otherwise @c NULL on failure
1081 * @retval notification_h Success
1082 * @retval NULL Failure
1083 * @exception #NOTIFICATION_ERROR_NONE Success
1084 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1085 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1086 * @see #notification_type_e
1089 #include <notification.h>
1092 notification_h noti = NULL;
1094 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1102 notification_h notification_create(notification_type_e type);
1105 * @brief Creates a notification clone.
1106 * @details Newly created notification handle is returned.
1108 * @remarks This cloned notification handle should be freed using notification_free().
1109 * @param[in] noti The notification handle
1110 * @param[out] clone The newly created notification handle that has same with input @a noti
1111 * @return #NOTIFICATION_ERROR_NONE if success,
1112 * otherwise any other value if failure
1113 * @retval #NOTIFICATION_ERROR_NONE Success
1114 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1115 * @see #notification_type_e
1118 #include <notification.h>
1121 notification_h noti = notification_create(NOTIFICATION_TYPE_NOTI);
1122 notification_h clone = NULL;
1124 notification_clone(noti, &clone);
1129 int notification_clone(notification_h noti, notification_h *clone);
1132 * @brief Frees the internal structure data of a notification handle.
1133 * @details Internal data of a notification handle is released. Data of the inserted notification is not deleted.
1135 * @param[in] noti The notification handle
1136 * @return #NOTIFICATION_ERROR_NONE on success,
1137 * otherwise any other value on failure
1138 * @retval #NOTIFICATION_ERROR_NONE Success
1139 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1140 * @pre Notification handle should be created by notification_create().
1143 #include <notification.h>
1146 notification_h noti = NULL;
1147 int noti_err = NOTIFICATION_ERROR_NONE;
1149 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1155 noti_err = notification_free(noti);
1156 if(noti_err != NOTIFICATION_ERROR_NONE) {
1162 int notification_free(notification_h noti);
1169 * @addtogroup NOTIFICATION_MODULE
1174 * @brief Sets the tag of the notification handle.
1176 * @param[in] noti Notification handle
1177 * @param[in] tag tag for loading notification handle
1178 * @return #NOTIFICATION_ERROR_NONE on success, other value on failure
1179 * @retval #NOTIFICATION_ERROR_NONE Success
1180 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1181 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1182 * @see notification_get_tag()
1185 #include <notification.h>
1188 notification_h noti = NULL;
1189 int noti_err = NOTIFICATION_ERROR_NONE;
1191 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1197 noti_err = notification_set_tag(noti, tag);
1198 if(noti_err != NOTIFICATION_ERROR_NONE) {
1204 int notification_set_tag(notification_h noti, const char *tag);
1207 * @brief Gets the tag of the notification handle.
1209 * @param[in] noti Notification handle
1210 * @param[out] tag tag for loading notification handle
1211 * @return #NOTIFICATION_ERROR_NONE on success, other value on failure
1212 * @retval #NOTIFICATION_ERROR_NONE Success
1213 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1214 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1215 * @see notification_set_tag()
1218 #include <notification.h>
1221 int noti_err = NOTIFICATION_ERROR_NONE;
1222 const char *tag = NULL;
1226 noti_err = notification_get_tag(noti, &tag);
1227 if(noti_err != NOTIFICATION_ERROR_NONE) {
1233 int notification_get_tag(notification_h noti, const char **tag);
1236 * @brief Loads a notification from the notification's database with the tag.
1239 * @privilege %http://tizen.org/privilege/notification
1240 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1241 * @param[in] tag tag for loading notification handle
1242 * @return Notification handle(notification_h) on success, NULL on failure
1243 * @retval notification_h Success
1244 * @retval NULL Failure
1245 * @exception #NOTIFICATION_ERROR_NONE Success
1246 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1247 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1248 * @exception #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1249 * @see #notification_type_e
1252 #include <notification.h>
1255 notification_h noti = NULL;
1257 noti = notification_load_by_tag(tag);
1265 notification_h notification_load_by_tag(const char *tag);
1268 * @brief Deletes all notifications of the given type.
1271 * @privilege %http://tizen.org/privilege/notification
1272 * @param[in] type Notification type
1273 * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
1274 * @retval #NOTIFICATION_ERROR_NONE Success
1275 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1276 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1279 #include <notification.h>
1282 int noti_err = NOTIFICATION_ERROR_NONE;
1284 noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
1285 if(noti_err != NOTIFICATION_ERROR_NONE) {
1291 int notification_delete_all(notification_type_e type);
1294 * @brief Posts a notification.
1297 * @privilege %http://tizen.org/privilege/notification
1298 * @param[in] noti Notification handle
1299 * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
1300 * @retval #NOTIFICATION_ERROR_NONE Success
1301 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1302 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1303 * @pre Notification handle should be created by notification_create().
1304 * @post notification_free().
1307 #include <notification.h>
1310 int noti_err = NOTIFICATION_ERROR_NONE;
1312 noti_err = notification_post(noti);
1313 if(noti_err != NOTIFICATION_ERROR_NONE) {
1319 int notification_post(notification_h noti);
1322 * @brief Sets permissions to application for updating or deletin the notification
1325 * @privilege %http://tizen.org/privilege/notification
1326 * @param[in] noti Notification handle
1327 * @param[in] permission_type permission type
1328 * @param[in] app_id target application id
1329 * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
1330 * @retval #NOTIFICATION_ERROR_NONE Success
1331 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1332 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1333 * @see #notification_get_permission
1334 * @see #notification_permission_type_e
1335 * @see #notification_h
1338 #include <notification.h>
1341 notification_h noti = NULL;
1342 int noti_err = NOTIFICATION_ERROR_NONE;
1344 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1350 noti_err = notification_set_permission(noti, NOTIFICATION_PERMISSION_TYPE_DELETE, "org.tizen.xxx");
1351 if(noti_err != NOTIFICATION_ERROR_NONE) {
1357 int notification_set_permission(notification_h handle, notification_permission_type_e permission_type, const char *app_id);
1360 * @brief Gets permissions of the notification
1361 * @remarks app_id must not be freed. This will be free with notification_free.
1364 * @privilege %http://tizen.org/privilege/notification
1365 * @param[in] noti Notification handle
1366 * @param[out] permission_type permission type
1367 * @param[out] app_id target application id
1368 * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
1369 * @retval #NOTIFICATION_ERROR_NONE Success
1370 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1371 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1372 * @see #notification_set_permission
1373 * @see #notification_permission_type_e
1374 * @see #notification_h
1377 #include <notification.h>
1380 int noti_err = NOTIFICATION_ERROR_NONE;
1381 notification_permission_type_e permission_type;
1382 const char *app_id = NULL;
1386 noti_err = notification_get_permission(noti, &permission_type, &app_id);
1387 if(noti_err != NOTIFICATION_ERROR_NONE) {
1393 int notification_get_permission(notification_h handle, notification_permission_type_e *permission_type, const char **app_id);
1396 * @brief Gets the package name of the notification
1397 * @remarks The pkgname must be released using free()
1399 * @param[in] noti Notification handle
1400 * @param[out] pkgname The package name of the notification
1401 * @return #NOTIFICATION_ERROR_NONE on success, otherwise a negative error value
1402 * @retval NOTIFICATION_ERROR_NONE Success
1403 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1406 #include <notification.h>
1409 notification_h noti = NULL;
1410 int noti_err = NOTIFICATION_ERROR_NONE;
1411 char *pkgname = NULL;
1415 noti_err = notification_get_pkgname(noti, &pkgname);
1417 if(noti_err != NOTIFICATION_ERROR_NONE) {
1418 notification_free(noti);
1425 int notification_get_pkgname(notification_h noti, char **pkgname);
1434 #endif /* __NOTIFICATION_H__ */