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,
324 * @brief Sets the text domain to localize the notification.
326 * @param[in] noti The notification handle
327 * @param[in] domain The text domain
328 * @param[in] dir The text dir
329 * @return #NOTIFICATION_ERROR_NONE on success,
330 * otherwise any other value on failure
331 * @retval #NOTIFICATION_ERROR_NONE Success
332 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
335 #include <notification.h>
338 notification_h noti = NULL;
339 int noti_err = NOTIFICATION_ERROR_NONE;
341 noti = notification_create(NOTIFICATION_TYPE_NOTI);
346 noti_err = notification_set_text_domain(noti, PACKAGE, LOCALEDIR);
347 if(noti_err != NOTIFICATION_ERROR_NONE) {
348 notification_free(noti);
354 int notification_set_text_domain(notification_h noti,
360 * @brief Gets the text domain from the notification handle.
362 * @remarks Do not free returned domain and dir. They are freed when notification_free() or notification_free_list() is called.
363 * @param[in] noti The notification handle
364 * @param[out] domain The domain
365 * @param[out] dir The locale dir
366 * @return #NOTIFICATION_ERROR_NONE on success,
367 * otherwise any other value on failure
368 * @retval #NOTIFICATION_ERROR_NONE Success
369 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
372 #include <notification.h>
375 notification_h noti = NULL;
376 int noti_err = NOTIFICATION_ERROR_NONE;
380 noti_err = notification_get_text_domain(noti, &domain, &dir);
381 if(noti_err != NOTIFICATION_ERROR_NONE) {
387 int notification_get_text_domain(notification_h noti,
392 * @brief Sets the sound type for the notification.
394 * @param[in] noti The notification handle
395 * @param[in] type The notification sound type
396 * @param[in] path The user sound file path
397 * @return #NOTIFICATION_ERROR_NONE on success,
398 * otherwise any other value on failure
399 * @retval #NOTIFICATION_ERROR_NONE Success
400 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
403 #include <notification.h>
406 notification_h noti = NULL;
407 int noti_err = NOTIFICATION_ERROR_NONE;
409 noti_err = notification_set_sound(noti, NOTIFICATION_SOUND_TYPE_DEFAULT, NULL);
410 if(noti_err != NOTIFICATION_ERROR_NONE) {
416 int notification_set_sound(notification_h noti,
417 notification_sound_type_e type,
421 * @brief Gets the sound type from the notification handle.
423 * @param[in] noti The notification handle
424 * @param[out] type The notification sound type
425 * @param[out] path The user sound file path
426 * @return #NOTIFICATION_ERROR_NONE on success,
427 * otherwise any other value on failure
428 * @retval #NOTIFICATION_ERROR_NONE Success
429 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
432 #include <notification.h>
435 notification_h noti = NULL;
436 int noti_err = NOTIFICATION_ERROR_NONE;
437 notification_sound_type_e type = NOTIFICATION_SOUND_TYPE_NONE;
439 noti_err = notification_get_sound(noti, &type, NULL);
440 if(noti_err != NOTIFICATION_ERROR_NONE) {
446 int notification_get_sound(notification_h noti,
447 notification_sound_type_e *type,
451 * @brief Sets the vibration type for the notification.
453 * @param[in] noti The notification handle
454 * @param[in] type The notification vibration type
455 * @param[in] path The user vibration file path
456 * @return #NOTIFICATION_ERROR_NONE on success,
457 * otherwise any other value on failure
458 * @retval #NOTIFICATION_ERROR_NONE Success
459 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
462 #include <notification.h>
465 notification_h noti = NULL;
466 int noti_err = NOTIFICATION_ERROR_NONE;
468 noti_err = notification_set_vibration(noti, NOTIFICATION_VIBRATION_TYPE_DEFAULT, NULL);
469 if(noti_err != NOTIFICATION_ERROR_NONE) {
475 int notification_set_vibration(notification_h noti,
476 notification_vibration_type_e type,
480 * @brief Gets the vibrate type from the notification handle.
482 * @param[in] noti The notification handle
483 * @param[out] type The notification sound type
484 * @param[out] path The user vibration file path
485 * @return #NOTIFICATION_ERROR_NONE on success,
486 * otherwise other value on failure
487 * @retval #NOTIFICATION_ERROR_NONE Success
488 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
491 #include <notification.h>
494 notification_h noti = NULL;
495 int noti_err = NOTIFICATION_ERROR_NONE;
496 notification_vibration_type_e type = NOTIFICATION_VIBRATION_TYPE_NONE;
498 noti_err = notification_get_vibration(noti, &type, NULL);
499 if(noti_err != NOTIFICATION_ERROR_NONE) {
505 int notification_get_vibration(notification_h noti,
506 notification_vibration_type_e *type,
510 * @brief Sets the LED displaying option.
512 * @param[in] noti The notification handle
513 * @param[in] operation The LED notification operation
514 * @param[in] led_argb The notification led color
515 * @return #NOTIFICATION_ERROR_NONE on success,
516 * otherwise other value on failure
517 * @retval #NOTIFICATION_ERROR_NONE Success
518 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
521 #include <notification.h>
524 notification_h noti = NULL;
525 int noti_err = NOTIFICATION_ERROR_NONE;
527 noti_err = notification_set_led(noti, NOTIFICATION_LED_TYPE_DEFAULT, NULL);
528 if(noti_err != NOTIFICATION_ERROR_NONE) {
534 int notification_set_led(notification_h noti,
535 notification_led_op_e operation,
539 * @brief Gets the LED displaying option from the notification handle.
541 * @param[in] noti The notification handle
542 * @param[out] operation The LED notification operation
543 * @param[out] led_argb The notification LED color
544 * @return #NOTIFICATION_ERROR_NONE on success,
545 * otherwise any other value on failure
546 * @retval #NOTIFICATION_ERROR_NONE Success
547 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
550 #include <notification.h>
553 notification_h noti = NULL;
554 int noti_err = NOTIFICATION_ERROR_NONE;
555 notification_led_type_e type = NOTIFICATION_LED_TYPE_NONE;
557 noti_err = notification_get_led(noti, &type, NULL);
558 if(noti_err != NOTIFICATION_ERROR_NONE) {
564 int notification_get_led(notification_h noti,
565 notification_led_op_e *operation,
569 * @brief Sets the time period of flashing the LED.
571 * @param[in] noti The notification handle
572 * @param[in] on_ms The time for turning on the LED
573 * @param[in] off_ms The time for turning off the LED
574 * @return #NOTIFICATION_ERROR_NONE on success,
575 * otherwise any other value on failure
576 * @retval #NOTIFICATION_ERROR_NONE Success
577 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
580 #include <notification.h>
583 notification_h noti = NULL;
584 int noti_err = NOTIFICATION_ERROR_NONE;
586 noti_err = notification_set_led_time_period(noti, 100, 100);
587 if(noti_err != NOTIFICATION_ERROR_NONE) {
593 int notification_set_led_time_period(notification_h noti,
594 int on_ms, int off_ms);
597 * @brief Gets the time period of flashing the LED from the notification handle.
599 * @param[in] noti The notification handle
600 * @param[out] on_ms The time for turning on the LED
601 * @param[out] off_ms The time for turning on the LED
602 * @return #NOTIFICATION_ERROR_NONE on success,
603 * otherwise any other value on failure
604 * @retval #NOTIFICATION_ERROR_NONE Success
605 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
608 #include <notification.h>
611 notification_h noti = NULL;
612 int noti_err = NOTIFICATION_ERROR_NONE;
616 noti_err = notification_get_led_time_period(noti, &led_on_ms, &led_off_ms);
617 if(noti_err != NOTIFICATION_ERROR_NONE) {
623 int notification_get_led_time_period(notification_h noti,
624 int *on_ms, int *off_ms);
627 * @brief Sets the launch option for a notification.
628 * @details When notification data selected in display application, application launched by app_control_send_launch_request with app_control handle.
630 * @param[in] noti The notification handle
631 * @param[in] type Launching option type
632 * @param[in] option App Control handler
633 * @return #NOTIFICATION_ERROR_NONE on success,
634 * otherwise any other value on failure
635 * @retval #NOTIFICATION_ERROR_NONE Success
636 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
639 #include <notification.h>
642 notification_h noti = NULL;
643 app_control_h app_control = NULL;
644 int noti_err = NOTIFICATION_ERROR_NONE;
648 app_control_create(&app_control);
649 app_control_set_app_id(app_control, "org.tizen.app");
653 noti_err = notification_set_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)app_control);
654 if(noti_err != NOTIFICATION_ERROR_NONE) {
655 notification_free(noti);
659 app_control_destroy(app_control);
663 int notification_set_launch_option(notification_h noti,
664 notification_launch_option_type type, void *option);
667 * @brief Gets the launch option from the notification handle.
669 * @remarks You must release @a app_control using app_control_destroy().
670 * @param[in] noti The notification handle
671 * @param[in] type Launching option type
672 * @param[out] option The pointer of App Control handler
673 * @return #NOTIFICATION_ERROR_NONE on success,
674 * otherwise any other value on failure
675 * @retval #NOTIFICATION_ERROR_NONE Success
676 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
679 #include <notification.h>
682 app_control_h app_control = NULL;
683 app_control_create(&app_control);
687 noti_err = notification_get_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)&app_control);
688 if(noti_err != NOTIFICATION_ERROR_NONE) {
689 notification_free(noti);
695 int notification_get_launch_option(notification_h noti,
696 notification_launch_option_type type, void *option);
699 * @brief Sets the handler for a specific event.
700 * @details When some event occurs on notification, application launched by app_control_send_launch_request with app_control handle.\n
701 * Setting event handler of a button means that the notification will show the button.
703 * @param[in] noti The notification handle
704 * @param[in] event_type event type
705 * @param[in] event_handler app control handle
706 * @return #NOTIFICATION_ERROR_NONE on success,
707 * otherwise any other value on failure
708 * @retval #NOTIFICATION_ERROR_NONE Success
709 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
710 * @see #notification_event_type_e
713 #include <notification.h>
716 notification_h noti = NULL;
717 app_control_h app_control = NULL;
718 int noti_err = NOTIFICATION_ERROR_NONE;
722 app_control_create(&app_control);
723 app_control_set_app_id(app_control, "org.tizen.app");
727 noti_err = notification_set_event_handler(noti, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, app_control);
728 if(noti_err != NOTIFICATION_ERROR_NONE) {
729 notification_free(noti);
733 app_control_destroy(app_control);
737 int notification_set_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h event_handler);
740 * @brief Gets the event handler of a specific event.
741 * @remarks You must release @a app_control using app_control_destroy().
743 * @param[in] noti The notification handle
744 * @param[in] event_type Launching option type
745 * @param[out] option The pointer of App Control handler
746 * @return #NOTIFICATION_ERROR_NONE on success,
747 * otherwise any other value on failure
748 * @retval #NOTIFICATION_ERROR_NONE Success
749 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
750 * @see #notification_event_type_e
753 #include <notification.h>
756 app_control_h app_control = NULL;
757 app_control_create(&app_control);
761 noti_err = notification_get_event_handler(noti, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, &app_control);
762 if(noti_err != NOTIFICATION_ERROR_NONE) {
763 notification_free(noti);
769 int notification_get_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h *event_handler);
772 * @brief Sets the property of the notification.
774 * @param[in] noti The notification handle
775 * @param[in] flags The property with | operation
776 * @return #NOTIFICATION_ERROR_NONE on success,
777 * otherwise any other value on failure
778 * @retval #NOTIFICATION_ERROR_NONE Success
779 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
782 #include <notification.h>
785 notification_h noti = NULL;
786 int noti_err = NOTIFICATION_ERROR_NONE;
789 noti = notification_create(NOTIFICATION_TYPE_NOTI);
794 noti_err = notification_set_property(noti, NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE | NOTIFICATION_PROP_DISABLE_APP_LAUNCH);
795 if(noti_err != NOTIFICATION_ERROR_NONE) {
796 notification_free(noti);
802 int notification_set_property(notification_h noti,
806 * @brief Gets the property of the notification from the notification handle.
808 * @param[in] noti The notification handle
809 * @param[out] flags The notification property
810 * @return #NOTIFICATION_ERROR_NONE on success,
811 * otherwise any other value on failure
812 * @retval #NOTIFICATION_ERROR_NONE Success
813 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
816 #include <notification.h>
819 notification_h noti = NULL;
820 int noti_err = NOTIFICATION_ERROR_NONE;
823 noti_err = notification_get_property(noti, &flags);
824 if(noti_err != NOTIFICATION_ERROR_NONE) {
830 int notification_get_property(notification_h noti,
834 * @brief Sets applications to display the notification.
835 * @details All display application is enable(NOTIFICATION_DISPLAY_APP_ALL) if you are not call this API.
837 * @param[in] noti The notification handle
838 * @param[in] applist The with | operation
839 * @return #NOTIFICATION_ERROR_NONE on success,
840 * otherwise any other value on failure
841 * @retval #NOTIFICATION_ERROR_NONE Success
842 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
845 #include <notification.h>
848 notification_h noti = NULL;
849 int noti_err = NOTIFICATION_ERROR_NONE;
852 noti = notification_create(NOTIFICATION_TYPE_NOTI);
857 noti_err = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_TICKER);
858 if(noti_err != NOTIFICATION_ERROR_NONE) {
859 notification_free(noti);
866 int notification_set_display_applist(notification_h noti,
870 * @brief Gets the application list displaying the notification from the notification handle.
872 * @param[in] noti The notification handle
873 * @param[out] applist The display application list
874 * @return #NOTIFICATION_ERROR_NONE on success,
875 * otherwise any other value on failure
876 * @retval #NOTIFICATION_ERROR_NONE Success
877 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
880 #include <notification.h>
883 notification_h noti = NULL;
884 int noti_err = NOTIFICATION_ERROR_NONE;
887 noti_err = notification_get_display_applist(noti, &applist);
888 if(noti_err != NOTIFICATION_ERROR_NONE) {
894 int notification_get_display_applist(notification_h noti,
898 * @brief Sets the initial size for the ongoing type.
899 * @details After notification_post() call, the size is not updated.
901 * @param[in] noti The notification handle
902 * @param[in] size The double type size
903 * @return #NOTIFICATION_ERROR_NONE on success,
904 * otherwise any other value on failure
905 * @retval #NOTIFICATION_ERROR_NONE Success
906 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
909 #include <notification.h>
912 notification_h noti = NULL;
913 int noti_err = NOTIFICATION_ERROR_NONE;
915 noti = notification_create(NOTIFICATION_TYPE_NOTI);
920 noti_err = notification_set_size(noti, 0.0);
921 if(noti_err != NOTIFICATION_ERROR_NONE) {
922 notification_free(noti);
928 int notification_set_size(notification_h noti,
932 * @brief Gets the progress size.
934 * @param[in] noti The notification handle
935 * @param[out] size The progress size
936 * @return #NOTIFICATION_ERROR_NONE on success,
937 * otherwise any other value on failure
938 * @retval #NOTIFICATION_ERROR_NONE Success
939 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
942 #include <notification.h>
945 notification_h noti = NULL;
946 int noti_err = NOTIFICATION_ERROR_NONE;
949 noti_err = notification_get_size(noti, &size);
950 if(noti_err != NOTIFICATION_ERROR_NONE) {
956 int notification_get_size(notification_h noti,
960 * @brief Sets the initial progress for the ongoing type.
961 * @details After the notification_post() call, the progress is not updated.
963 * @param[in] noti The notification handle
964 * @param[in] percentage The progress percentage
965 * @return #NOTIFICATION_ERROR_NONE on success,
966 * otherwise any other value on failure
967 * @retval #NOTIFICATION_ERROR_NONE Success
968 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
971 #include <notification.h>
974 notification_h noti = NULL;
975 int noti_err = NOTIFICATION_ERROR_NONE;
977 noti = notification_create(NOTIFICATION_TYPE_NOTI);
982 noti_err = notification_set_progress(noti, 0.0);
983 if(noti_err != NOTIFICATION_ERROR_NONE) {
984 notification_free(noti);
990 int notification_set_progress(notification_h noti,
994 * @brief Gets the progress from the notification handle.
996 * @remarks At the end of the operation, the progress should be @c 1.0.
997 * @param[in] noti The notification handle
998 * @param[out] percentage The progress percentage
999 * @return #NOTIFICATION_ERROR_NONE on success,
1000 * otherwise any other value on failure
1001 * @retval #NOTIFICATION_ERROR_NONE Success
1002 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1005 #include <notification.h>
1008 notification_h noti = NULL;
1009 int noti_err = NOTIFICATION_ERROR_NONE;
1010 double percentage = 0.0;
1012 noti_err = notification_get_progress(noti, &percentage);
1013 if(noti_err != NOTIFICATION_ERROR_NONE) {
1019 int notification_get_progress(notification_h noti,
1020 double *percentage);
1023 * @brief Sets the layout of the notification view.
1024 * @details Caller can set displaying layout of notification.
1026 * @param[in] noti The notification handle
1027 * @param[in] layout The type of layout
1028 * @return #NOTIFICATION_ERROR_NONE on success,
1029 * otherwise any other value on failure
1030 * @retval #NOTIFICATION_ERROR_NONE Success
1031 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1032 * @see #notification_ly_type_e
1034 int notification_set_layout(notification_h noti,
1035 notification_ly_type_e layout);
1038 * @brief Gets the layout of the notification view from the notification handle.
1040 * @param[in] noti The notification handle
1041 * @param[out] layout The type of layout
1042 * @return #NOTIFICATION_ERROR_NONE on success,
1043 * otherwise any other value on failure
1044 * @retval #NOTIFICATION_ERROR_NONE Success
1045 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1046 * @see #notification_ly_type_e
1048 int notification_get_layout(notification_h noti,
1049 notification_ly_type_e *layout);
1052 * @brief Gets the type of a notification.
1054 * @param[in] noti The notification handle
1055 * @param[out] type The notification type
1056 * @return #NOTIFICATION_ERROR_NONE on success,
1057 * otherwise any other value on failure
1058 * @retval #NOTIFICATION_ERROR_NONE Success
1059 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1062 #include <notification.h>
1065 int noti_err = NOTIFICATION_ERROR_NONE;
1066 notification_type_e type;
1068 noti_err = notification_get_type(noti, &type);
1069 if(noti_err != NOTIFICATION_ERROR_NONE) {
1075 int notification_get_type(notification_h noti,
1076 notification_type_e * type);
1080 * @brief Inserts a notification.
1081 * @details The notification will be inserted to the database and then it will appear in the notification area.
1082 * When notification_create() is called, if priv_id is #NOTIFICATION_PRIV_ID_NONE, priv_id returns the internally set priv_id.
1085 * @privilege %http://tizen.org/privilege/notification
1086 * @param[in] noti The notification handle
1087 * @param[out] priv_id The private ID
1088 * @return #NOTIFICATION_ERROR_NONE on success,
1089 * otherwise any other value on failure
1090 * @retval #NOTIFICATION_ERROR_NONE Success
1091 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1092 * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1093 * @pre Notification handle should be created by notification_create().
1094 * @post notification_free().
1097 #include <notification.h>
1100 int noti_err = NOTIFICATION_ERROR_NONE;
1102 noti_err = notification_insert(noti, NULL);
1103 if(noti_err != NOTIFICATION_ERROR_NONE) {
1109 int notification_insert(notification_h noti,
1113 * @brief Updates notification data.
1114 * @details The updated notification will appear in the notification area.
1117 * @privilege %http://tizen.org/privilege/notification
1118 * @param[in] noti The notification handle that is created by notification_create()
1119 * @return #NOTIFICATION_ERROR_NONE on success,
1120 * otherwise any other value on failure
1121 * @retval #NOTIFICATION_ERROR_NONE Success
1122 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1123 * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Priv ID does not exist
1124 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1127 #include <notification.h>
1130 int noti_err = NOTIFICATION_ERROR_NONE;
1132 noti_err = notification_update(NULL);
1133 if(noti_err != NOTIFICATION_ERROR_NONE) {
1139 int notification_update(notification_h noti);
1143 * @brief Updates a notification, asynchronously.
1144 * @details The updated notification will appear in the notification area.
1147 * @privilege %http://tizen.org/privilege/notification
1148 * @remarks This function updates the notification asynchronously.
1149 * @param[in] noti The notification handle that is created by notification_create()
1150 * @param[in] result_cb The callback called when an update completed
1151 * @param[in] user_data The user data which you want to use in callback
1152 * @return #NOTIFICATION_ERROR_NONE on success,
1153 * otherwise any other value on failure
1154 * @retval #NOTIFICATION_ERROR_NONE Success
1155 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1156 * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Priv ID does not exist
1157 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1160 #include <notification.h>
1163 int noti_err = NOTIFICATION_ERROR_NONE;
1165 noti_err = notification_update_async(NULL, result_cb, data);
1166 if(noti_err != NOTIFICATION_ERROR_NONE) {
1172 int notification_update_async(notification_h noti,
1173 void (*result_cb)(int priv_id, int result, void *data), void *user_data);
1176 * @brief Deletes a notification with the given handle.
1177 * @details notification_delete() removes notification data from database and notification_free() releases memory of notification data.
1180 * @privilege %http://tizen.org/privilege/notification
1181 * @param[in] noti The notification handle
1182 * @return #NOTIFICATION_ERROR_NONE on success,
1183 * otherwise any other value on failure
1184 * @retval #NOTIFICATION_ERROR_NONE Success
1185 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1186 * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1189 #include <notification.h>
1192 notificaton_h noti = NULL;
1193 int noti_err = NOTIFICATION_ERROR_NONE;
1197 noti_err = notification_delete(noti);
1198 if(noti_err != NOTIFICATION_ERROR_NONE) {
1205 int notification_delete(notification_h noti);
1208 * @brief Creates internal structure data and returns a notification handle.
1209 * @details Available type is #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING.
1210 * #NOTIFICATION_TYPE_NOTI is remaining notification data even if device is restarted.
1211 * #NOTIFICATION_TYPE_ONGOING can display progressive feather, but notification data is removed after device is restarted.
1213 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1214 * @param[in] type The notification type
1215 * @return Notification handle(notification_h) on success,
1216 * otherwise @c NULL on failure
1217 * @retval notification_h Success
1218 * @retval NULL Failure
1219 * @exception #NOTIFICATION_ERROR_NONE Success
1220 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1221 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1222 * @see #notification_type_e
1225 #include <notification.h>
1228 notification_h noti = NULL;
1230 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1238 notification_h notification_create(notification_type_e type);
1241 * @brief Creates a notification clone.
1242 * @details Newly created notification handle is returned.
1244 * @remarks This cloned notification handle should be freed using notification_free().
1245 * @param[in] noti The notification handle
1246 * @param[out] clone The newly created notification handle that has same with input @a noti
1247 * @return #NOTIFICATION_ERROR_NONE if success,
1248 * otherwise any other value if failure
1249 * @retval #NOTIFICATION_ERROR_NONE Success
1250 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1251 * @see #notification_type_e
1254 #include <notification.h>
1257 notification_h noti = notification_create(NOTIFICATION_TYPE_NOTI);
1258 notification_h clone = NULL;
1260 notification_clone(noti, &clone);
1265 int notification_clone(notification_h noti, notification_h *clone);
1268 * @brief Frees the internal structure data of a notification handle.
1269 * @details Internal data of a notification handle is released. Data of the inserted notification is not deleted.
1271 * @param[in] noti The notification handle
1272 * @return #NOTIFICATION_ERROR_NONE on success,
1273 * otherwise any other value on failure
1274 * @retval #NOTIFICATION_ERROR_NONE Success
1275 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1276 * @pre Notification handle should be created by notification_create().
1279 #include <notification.h>
1282 notification_h noti = NULL;
1283 int noti_err = NOTIFICATION_ERROR_NONE;
1285 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1291 noti_err = notification_free(noti);
1292 if(noti_err != NOTIFICATION_ERROR_NONE) {
1298 int notification_free(notification_h noti);
1306 * @addtogroup NOTIFICATION_LIST
1312 * @brief Returns the notification list handle.
1313 * @details If count is equal to @c -1, all notifications are returned.
1316 * @privilege %http://tizen.org/privilege/notification
1317 * @param[in] type The notification type
1318 * @param[in] count The returned notification data number
1319 * @param[out] #NOTIFICATION_ERROR_NONE on success, other value on failure
1320 * @return #NOTIFICATION_ERROR_NONE on success,
1321 * otherwise any other value on failure
1322 * @retval #NOTIFICATION_ERROR_NONE Success
1323 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1324 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1325 * @see #notification_list_h
1328 #include <notification.h>
1331 notification_list_h noti_list = NULL;
1332 int noti_err = NOTIFICATION_ERROR_NONE;
1334 noti_err = notification_get_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list);
1335 if(noti_err != NOTIFICATION_ERROR_NONE) {
1341 int notification_get_list(notification_type_e type,
1343 notification_list_h * list);
1347 * @brief Returns the notification detail list handle of grouping data.
1348 * @details If count is equal to c -1, all notifications are returned.
1351 * @privilege %http://tizen.org/privilege/notification
1352 * @param[in] pkgname The caller application package name
1353 * @param[in] group_id The group ID
1354 * @param[in] priv_id The private ID
1355 * @param[in] count The returned notification data number
1356 * @param[out] list The notification list handle
1357 * @return #NOTIFICATION_ERROR_NONE if success,
1358 * other value if failure
1359 * @retval #NOTIFICATION_ERROR_NONE Success
1360 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1361 * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1362 * @see #notification_list_h
1365 #include <notification.h>
1368 notification_list_h noti_list = NULL;
1369 int noti_err = NOTIFICATION_ERROR_NONE;
1371 noti_err = notification_get_detail_list(pkgname, group_id, priv_id, -1, ¬i_list);
1372 if(noti_err != NOTIFICATION_ERROR_NONE) {
1378 int notification_get_detail_list(const char *pkgname,
1382 notification_list_h *list);
1386 * @brief Frees a notification list.
1389 * @privilege %http://tizen.org/privilege/notification
1390 * @param[in] list The notification list handle
1391 * @return #NOTIFICATION_ERROR_NONE on success,
1392 * otherwise any other value on failure
1393 * @retval #NOTIFICATION_ERROR_NONE Success
1394 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1395 * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1396 * @pre notification_get_grouping_list() or notification_get_detail_list().
1397 * @see #notification_list_h
1400 #include <notification.h>
1403 notification_list_h noti_list = NULL;
1404 int noti_err = NOTIFICATION_ERROR_NONE;
1408 noti_err = notification_free_list(noti_list);
1409 if(noti_err != NOTIFICATION_ERROR_NONE) {
1415 int notification_free_list(notification_list_h list);
1422 * @addtogroup NOTIFICATION_MODULE
1428 * @brief Registers a callback for all notification events.
1429 * @details The registered callback could be called for all notification events.
1432 * @privilege %http://tizen.org/privilege/notification
1433 * @param[in] changed_cb The callback function
1434 * @param[in] user_data The user data
1435 * @return #NOTIFICATION_ERROR_NONE on success,
1436 * otherwise any other value on failure
1437 * @retval #NOTIFICATION_ERROR_NONE Success
1438 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1439 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1440 * @see notification_unregister_detailed_changed_cb()
1443 #include <notification.h>
1446 noti_err = notification_register_detailed_changed_cb(app_changed_cb, user_data);
1447 if(noti_err != NOTIFICATION_ERROR_NONE) {
1453 int notification_register_detailed_changed_cb(
1454 void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
1459 * @brief Unregisters a callback for all notification events.
1462 * @privilege %http://tizen.org/privilege/notification
1463 * @param[in] changed_cb The callback function
1464 * @return #NOTIFICATION_ERROR_NONE on success,
1465 * otherwise any other value on failure
1466 * @retval #NOTIFICATION_ERROR_NONE Success
1467 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1468 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1469 * @see notification_register_detailed_changed_cb()
1472 #include <notification.h>
1475 noti_err = notification_register_detailed_changed_cb(app_changed_cb, user_data);
1476 if(noti_err != NOTIFICATION_ERROR_NONE) {
1482 int notification_unregister_detailed_changed_cb(
1483 void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
1487 * @brief Sets the tag of the notification handle.
1489 * @param[in] noti Notification handle
1490 * @param[in] tag tag for loading notification handle
1491 * @return #NOTIFICATION_ERROR_NONE on success, other value on failure
1492 * @retval #NOTIFICATION_ERROR_NONE Success
1493 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1494 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1495 * @see notification_get_tag()
1498 #include <notification.h>
1501 notification_h noti = NULL;
1502 int noti_err = NOTIFICATION_ERROR_NONE;
1504 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1510 noti_err = notification_set_tag(noti, tag);
1511 if(noti_err != NOTIFICATION_ERROR_NONE) {
1517 int notification_set_tag(notification_h noti, const char *tag);
1520 * @brief Gets the tag of the notification handle.
1522 * @param[in] noti Notification handle
1523 * @param[out] tag tag for loading notification handle
1524 * @return #NOTIFICATION_ERROR_NONE on success, other value on failure
1525 * @retval #NOTIFICATION_ERROR_NONE Success
1526 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1527 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1528 * @see notification_set_tag()
1531 #include <notification.h>
1534 int noti_err = NOTIFICATION_ERROR_NONE;
1535 const char *tag = NULL;
1539 noti_err = notification_get_tag(noti, &tag);
1540 if(noti_err != NOTIFICATION_ERROR_NONE) {
1546 int notification_get_tag(notification_h noti, const char **tag);
1550 * @brief Gets the package name of the notification
1553 * @param[in] noti Notification handle
1554 * @param[out] pkgname package name of the notification
1555 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
1556 * @retval NOTIFICATION_ERROR_NONE Success
1557 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1560 #include <notification.h>
1563 notification_h noti = NULL;
1564 int noti_err = NOTIFICATION_ERROR_NONE;
1565 char *pkgname = NULL;
1567 noti_err = notification_get_pkgname(noti, &pkgname);
1568 if(noti_err != NOTIFICATION_ERROR_NONE) {
1574 int notification_get_pkgname(notification_h noti, char **pkgname);
1577 * @brief Loads a notification from the notification's database with the tag.
1580 * @privilege %http://tizen.org/privilege/notification
1581 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1582 * @param[in] tag tag for loading notification handle
1583 * @return Notification handle(notification_h) on success, NULL on failure
1584 * @retval notification_h Success
1585 * @retval NULL Failure
1586 * @exception #NOTIFICATION_ERROR_NONE Success
1587 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1588 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1589 * @exception #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1590 * @see #notification_type_e
1593 #include <notification.h>
1596 notification_h noti = NULL;
1598 noti = notification_load_by_tag(tag);
1606 notification_h notification_load_by_tag(const char *tag);
1609 * @brief Deletes all notifications of the given type.
1612 * @privilege %http://tizen.org/privilege/notification
1613 * @param[in] type Notification type
1614 * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
1615 * @retval #NOTIFICATION_ERROR_NONE Success
1616 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1617 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1620 #include <notification.h>
1623 int noti_err = NOTIFICATION_ERROR_NONE;
1625 noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
1626 if(noti_err != NOTIFICATION_ERROR_NONE) {
1632 int notification_delete_all(notification_type_e type);
1635 * @brief Posts a notification.
1638 * @privilege %http://tizen.org/privilege/notification
1639 * @param[in] noti Notification handle
1640 * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
1641 * @retval #NOTIFICATION_ERROR_NONE Success
1642 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1643 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1644 * @pre Notification handle should be created by notification_create().
1645 * @post notification_free().
1648 #include <notification.h>
1651 int noti_err = NOTIFICATION_ERROR_NONE;
1653 noti_err = notification_post(noti);
1654 if(noti_err != NOTIFICATION_ERROR_NONE) {
1660 int notification_post(notification_h noti);
1669 #endif /* __NOTIFICATION_H__ */