2 * Copyright (c) 2000 - 2017 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #ifndef __NOTIFICATION_H__
19 #define __NOTIFICATION_H__
24 #include <app_control.h>
27 #include <notification_error.h>
28 #include <notification_type.h>
29 #include <notification_status.h>
38 * @file notification.h
39 * @brief This file contains the notification API.
44 * @addtogroup NOTIFICATION_MODULE
50 * @brief Sets an absolute path for an image file to display on the notification view.
51 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
52 * @param[in] noti The notification handle
53 * @param[in] type The notification image type
54 * @param[in] image_path The image file full path
55 * @return #NOTIFICATION_ERROR_NONE on success,
56 * otherwise any other value on failure
57 * @retval #NOTIFICATION_ERROR_NONE Success
58 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
59 * @pre Notification handle should be created by notification_create().
60 * @see #notification_image_type_e
61 * @see notification_create()
64 #include <notification.h>
67 notification_h noti = NULL;
68 int noti_err = NOTIFICATION_ERROR_NONE;
70 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, notification_image_type_e type, const char *image_path);
86 * @brief Gets the absolute path of an image file.
87 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
88 * @remarks Do not free @a image_path. It will be freed when notification_free() is called.
89 * @param[in] noti Notification handle
90 * @param[in] type Notification image type
91 * @param[out] image_path Image file full path
92 * @return NOTIFICATION_ERROR_NONE on success,
93 * 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)
113 int notification_get_image(notification_h noti, notification_image_type_e type, char **image_path);
117 * @brief Sets a timestamp.
118 * @details If input_time is @c 0, time information is taken from the current time.
119 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
120 * @param[in] noti The notification handle
121 * @param[in] input_time The input time. If you want the time stamp to not be shown, set this as NOTIFICATION_DO_NOT_SHOW_TIME_STAMP
122 * @return #NOTIFICATION_ERROR_NONE on success,
123 * otherwise any other value on failure
124 * @retval #NOTIFICATION_ERROR_NONE Success
125 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
126 * @pre Notification handle should be created by notification_create().
127 * @see notification_create()
128 * @see NOTIFICATION_DO_NOT_SHOW_TIME_STAMP
131 #include <notification.h>
134 notification_h noti = NULL;
135 int noti_err = NOTIFICATION_ERROR_NONE;
137 noti = notification_create(NOTIFICATION_TYPE_NOTI);
141 noti_err = notification_set_time(noti, time(NULL));
142 if (noti_err != NOTIFICATION_ERROR_NONE) {
143 notification_free(noti);
149 int notification_set_time(notification_h noti, time_t input_time);
153 * @brief Gets a timestamp.
154 * @details If ret_time is @c 0, time information is not set before.
155 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
156 * @param[in] noti The notification handle
157 * @param[out] ret_time The return time value
158 * @return #NOTIFICATION_ERROR_NONE on success,
159 * otherwise any other value on failure
160 * @retval #NOTIFICATION_ERROR_NONE Success
161 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
162 * @pre Notification handle should be created by notification_create().
163 * @see notification_create()
166 #include <notification.h>
170 int noti_err = NOTIFICATION_ERROR_NONE;
172 noti_err = notification_get_time(noti, &ret_time);
173 if (noti_err != NOTIFICATION_ERROR_NONE)
178 int notification_get_time(notification_h noti, time_t *ret_time);
182 * @brief Gets an insertion timestamp of the notification.
183 * @details If ret_time is @c 0, this notification data is not inserted before.
184 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
185 * @param[in] noti The notification handle
186 * @param[out] ret_time The return time value
187 * @return #NOTIFICATION_ERROR_NONE on success,
188 * otherwise any other value on failure
189 * @retval #NOTIFICATION_ERROR_NONE Success
190 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
193 #include <notification.h>
197 int noti_err = NOTIFICATION_ERROR_NONE;
199 noti_err = notification_get_insert_time(noti, &ret_time);
200 if (noti_err != NOTIFICATION_ERROR_NONE)
205 int notification_get_insert_time(notification_h noti, time_t *ret_time);
209 * @brief Sets the text to display on the notification view.
210 * @details Sets title, content string. If the text is formatted data (only %d, %f, %s are supported), type - value pair should be set.
211 * If %d, the type #NOTIFICATION_VARIABLE_TYPE_INT and the value is an integer.
212 * If %f, the type #NOTIFICATION_VARIABLE_TYPE_DOUBLE and the value is a double.
213 * If %s, the type #NOTIFICATION_VARIABLE_TYPE_STRING and the value is a string.
214 * If the type is #NOTIFICATION_VARIABLE_TYPE_COUNT, notification count is displaying with text.
215 * If the value is #NOTIFICATION_COUNT_POS_LEFT, count is displayed at the left of the text.
216 * If the value is #NOTIFICATION_COUNT_POS_IN, count is displayed in the text when text has %d format.
217 * If the value is #NOTIFICATION_COUNT_POS_RIGHT, count is displayed at the right of the text.
218 * Variable parameters should be terminated #NOTIFICATION_VARIABLE_TYPE_NONE.
219 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
220 * @param[in] noti The notification handle
221 * @param[in] type The notification text type
222 * @param[in] text The basic text
223 * @param[in] key The text key for localization
224 * @param[in] args_type The variable parameter that type - value pair
225 * @return #NOTIFICATION_ERROR_NONE on success,
226 * otherwise any other value on failure
227 * @retval #NOTIFICATION_ERROR_NONE Success
228 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
229 * @pre notification handle should be created by notification_create().
232 #include <notification.h>
235 notification_h noti = NULL;
236 int noti_err = NOTIFICATION_ERROR_NONE;
238 noti = notification_create(NOTIFICATION_TYPE_NOTI);
242 noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "I'm Title",
243 "IDS_APP_BODY_IM_TITLE", NOTIFICATION_VARIABLE_TYPE_NONE);
244 if (noti_err != NOTIFICATION_ERROR_NONE) {
245 notification_free(noti);
251 int notification_set_text(notification_h noti, notification_text_type_e type,
252 const char *text, const char *key, int args_type, ...);
256 * @brief Gets the text from the notification handle.
257 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
258 * @param[in] noti The notification handle
259 * @param[in] type The notification text type
260 * @param[out] text The notification text
261 * @return #NOTIFICATION_ERROR_NONE on success,
262 * otherwise any other value on failure
263 * @retval #NOTIFICATION_ERROR_NONE Success
264 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
267 #include <notification.h>
270 notification_h noti = NULL;
271 int noti_err = NOTIFICATION_ERROR_NONE;
274 noti_err = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, &text);
275 if (noti_err != NOTIFICATION_ERROR_NONE)
281 int notification_get_text(notification_h noti, notification_text_type_e type, char **text);
285 * @brief Sets the timestamp to display on the notification view.
286 * @details The timestamp will be converted to a formatted string and it will be displayed on the set text area.
287 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
288 * @param[in] noti The notification handle
289 * @param[in] type The notification text type
290 * @param[in] time The timestamp
291 * @return #NOTIFICATION_ERROR_NONE on success,
292 * otherwise any other value on failure
293 * @retval #NOTIFICATION_ERROR_NONE Success
294 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
295 * @pre Notification handle should be created by notification_create().
297 int notification_set_time_to_text(notification_h noti, notification_text_type_e type, time_t time);
301 * @brief Gets the timestamp from the notification handle.
302 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
303 * @param[in] noti The notification handle
304 * @param[in] type The notification text type
305 * @param[in] time The pointer of time stamp
306 * @return #NOTIFICATION_ERROR_NONE on success,
307 * otherwise any other value on failure
308 * @retval #NOTIFICATION_ERROR_NONE Success
309 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
310 * @pre Notification handle should be created by notification_create().
312 int notification_get_time_from_text(notification_h noti, notification_text_type_e type, time_t *time);
316 * @brief Sets the sound type for the notification.
317 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
318 * @param[in] noti The notification handle
319 * @param[in] type The notification sound type
320 * @param[in] path The user sound file path
321 * @return #NOTIFICATION_ERROR_NONE on success,
322 * otherwise any other value on failure
323 * @retval #NOTIFICATION_ERROR_NONE Success
324 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
327 #include <notification.h>
330 notification_h noti = NULL;
331 int noti_err = NOTIFICATION_ERROR_NONE;
333 noti_err = notification_set_sound(noti, NOTIFICATION_SOUND_TYPE_DEFAULT, NULL);
334 if (noti_err != NOTIFICATION_ERROR_NONE)
340 int notification_set_sound(notification_h noti, notification_sound_type_e type, const char *path);
344 * @brief Gets the sound type from the notification handle.
345 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
346 * @param[in] noti The notification handle
347 * @param[out] type The notification sound type
348 * @param[out] path The user sound file path
349 * @return #NOTIFICATION_ERROR_NONE on success,
350 * otherwise any other value on failure
351 * @retval #NOTIFICATION_ERROR_NONE Success
352 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
355 #include <notification.h>
358 notification_h noti = NULL;
359 int noti_err = NOTIFICATION_ERROR_NONE;
360 notification_sound_type_e type = NOTIFICATION_SOUND_TYPE_NONE;
362 noti_err = notification_get_sound(noti, &type, NULL);
363 if (noti_err != NOTIFICATION_ERROR_NONE)
369 int notification_get_sound(notification_h noti, notification_sound_type_e *type, const char **path);
373 * @brief Sets the vibration type for the notification.
374 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
375 * @param[in] noti The notification handle
376 * @param[in] type The notification vibration type
377 * @param[in] path The user vibration file path
378 * @return #NOTIFICATION_ERROR_NONE on success,
379 * otherwise any other value on failure
380 * @retval #NOTIFICATION_ERROR_NONE Success
381 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
384 #include <notification.h>
387 notification_h noti = NULL;
388 int noti_err = NOTIFICATION_ERROR_NONE;
390 noti_err = notification_set_vibration(noti, NOTIFICATION_VIBRATION_TYPE_DEFAULT, NULL);
391 if (noti_err != NOTIFICATION_ERROR_NONE)
397 int notification_set_vibration(notification_h noti, notification_vibration_type_e type, const char *path);
401 * @brief Gets the vibrate type from the notification handle.
402 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
403 * @param[in] noti The notification handle
404 * @param[out] type The notification sound type
405 * @param[out] path The user vibration file path
406 * @return #NOTIFICATION_ERROR_NONE on success,
407 * otherwise other value on failure
408 * @retval #NOTIFICATION_ERROR_NONE Success
409 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
412 #include <notification.h>
415 notification_h noti = NULL;
416 int noti_err = NOTIFICATION_ERROR_NONE;
417 notification_vibration_type_e type = NOTIFICATION_VIBRATION_TYPE_NONE;
419 noti_err = notification_get_vibration(noti, &type, NULL);
420 if (noti_err != NOTIFICATION_ERROR_NONE)
426 int notification_get_vibration(notification_h noti, notification_vibration_type_e *type, const char **path);
430 * @brief Sets the LED displaying option.
431 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
432 * @param[in] noti The notification handle
433 * @param[in] operation The LED notification operation
434 * @param[in] led_argb The notification LED color
435 * @return #NOTIFICATION_ERROR_NONE on success,
436 * otherwise other value on failure
437 * @retval #NOTIFICATION_ERROR_NONE Success
438 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
441 #include <notification.h>
444 notification_h noti = NULL;
445 int noti_err = NOTIFICATION_ERROR_NONE;
447 noti_err = notification_set_led(noti, NOTIFICATION_LED_OP_ON, NULL);
448 if (noti_err != NOTIFICATION_ERROR_NONE)
454 int notification_set_led(notification_h noti, notification_led_op_e operation, int led_argb);
458 * @brief Gets the LED displaying option from the notification handle.
459 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
460 * @param[in] noti The notification handle
461 * @param[out] operation The LED notification operation
462 * @param[out] led_argb The notification LED color
463 * @return #NOTIFICATION_ERROR_NONE on success,
464 * otherwise any other value on failure
465 * @retval #NOTIFICATION_ERROR_NONE Success
466 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
469 #include <notification.h>
472 notification_h noti = NULL;
473 int noti_err = NOTIFICATION_ERROR_NONE;
474 notification_led_type_e type = NOTIFICATION_LED_OP_OFF;
476 noti_err = notification_get_led(noti, &type, NULL);
477 if (noti_err != NOTIFICATION_ERROR_NONE)
483 int notification_get_led(notification_h noti, notification_led_op_e *operation, int *led_argb);
487 * @brief Sets the time period of flashing the LED.
488 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
489 * @param[in] noti The notification handle
490 * @param[in] on_ms The time for turning on the LED
491 * @param[in] off_ms The time for turning off the LED
492 * @return #NOTIFICATION_ERROR_NONE on success,
493 * otherwise any other value on failure
494 * @retval #NOTIFICATION_ERROR_NONE Success
495 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
498 #include <notification.h>
501 notification_h noti = NULL;
502 int noti_err = NOTIFICATION_ERROR_NONE;
504 noti_err = notification_set_led_time_period(noti, 100, 100);
505 if (noti_err != NOTIFICATION_ERROR_NONE)
511 int notification_set_led_time_period(notification_h noti, int on_ms, int off_ms);
515 * @brief Gets the time period of flashing the LED from the notification handle.
516 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
517 * @param[in] noti The notification handle
518 * @param[out] on_ms The time for turning on the LED
519 * @param[out] off_ms The time for turning on the LED
520 * @return #NOTIFICATION_ERROR_NONE on success,
521 * otherwise any other value on failure
522 * @retval #NOTIFICATION_ERROR_NONE Success
523 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
526 #include <notification.h>
529 notification_h noti = NULL;
530 int noti_err = NOTIFICATION_ERROR_NONE;
534 noti_err = notification_get_led_time_period(noti, &led_on_ms, &led_off_ms);
535 if (noti_err != NOTIFICATION_ERROR_NONE)
541 int notification_get_led_time_period(notification_h noti, int *on_ms, int *off_ms);
545 * @brief Sets the launch option for a notification.
546 * @details When notification data selected in display application, application launched by app_control_send_launch_request with app_control handle.
547 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
548 * @param[in] noti The notification handle
549 * @param[in] type Launching option type
550 * @param[in] option App Control handler
551 * @return #NOTIFICATION_ERROR_NONE on success,
552 * otherwise any other value on failure
553 * @retval #NOTIFICATION_ERROR_NONE Success
554 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
557 #include <notification.h>
560 notification_h noti = NULL;
561 app_control_h app_control = NULL;
562 int noti_err = NOTIFICATION_ERROR_NONE;
566 app_control_create(&app_control);
567 app_control_set_app_id(app_control, "org.tizen.app");
571 noti_err = notification_set_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)app_control);
572 if (noti_err != NOTIFICATION_ERROR_NONE) {
573 app_control_destroy(app_control);
574 notification_free(noti);
578 app_control_destroy(app_control);
582 int notification_set_launch_option(notification_h noti, notification_launch_option_type type, void *option);
586 * @brief Gets the launch option from the notification handle.
587 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
588 * @remarks You must release @a app_control using app_control_destroy().
589 * @param[in] noti The notification handle
590 * @param[in] type Launching option type
591 * @param[out] option The pointer of App Control handler
592 * @return #NOTIFICATION_ERROR_NONE on success,
593 * otherwise any other value on failure
594 * @retval #NOTIFICATION_ERROR_NONE Success
595 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
598 #include <notification.h>
601 app_control_h app_control = NULL;
602 app_control_create(&app_control);
606 noti_err = notification_get_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)&app_control);
607 if (noti_err != NOTIFICATION_ERROR_NONE)
612 int notification_get_launch_option(notification_h noti, notification_launch_option_type type, void *option);
616 * @brief Sets the handler for a specific event.
617 * @details When some event occurs on notification, application launched by app_control_send_launch_request with app_control handle. \n
618 * Setting event handler of a button means that the notification will show the button.
619 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
620 * @param[in] noti The notification handle
621 * @param[in] event_type Event type
622 * @param[in] event_handler App control handle
623 * @return #NOTIFICATION_ERROR_NONE on success,
624 * otherwise any other value on failure
625 * @retval #NOTIFICATION_ERROR_NONE Success
626 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
627 * @see #notification_event_type_e
630 #include <notification.h>
633 notification_h noti = NULL;
634 app_control_h app_control = NULL;
635 int noti_err = NOTIFICATION_ERROR_NONE;
639 app_control_create(&app_control);
640 app_control_set_app_id(app_control, "org.tizen.app");
644 noti_err = notification_set_event_handler(noti, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, app_control);
645 if (noti_err != NOTIFICATION_ERROR_NONE) {
646 app_control_destroy(app_control);
647 notification_free(noti);
651 app_control_destroy(app_control);
655 int notification_set_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h event_handler);
659 * @brief Gets the event handler of a specific event.
660 * @remarks You must release @a app_control using app_control_destroy().
661 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
662 * @param[in] noti The notification handle
663 * @param[in] event_type Launching option type
664 * @param[out] event_handler The handler of App Control
665 * @return #NOTIFICATION_ERROR_NONE on success,
666 * otherwise any other value on failure
667 * @retval #NOTIFICATION_ERROR_NONE Success
668 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
669 * @see #notification_event_type_e
672 #include <notification.h>
675 app_control_h app_control = NULL;
676 app_control_create(&app_control);
680 noti_err = notification_get_event_handler(noti, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, &app_control);
681 if (noti_err != NOTIFICATION_ERROR_NONE) {
682 notification_free(noti);
688 int notification_get_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h *event_handler);
692 * @brief Sets the property of the notification.
693 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
694 * @param[in] noti The notification handle
695 * @param[in] flags The property with | operation
696 * @return #NOTIFICATION_ERROR_NONE on success,
697 * otherwise any other value on failure
698 * @retval #NOTIFICATION_ERROR_NONE Success
699 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
702 #include <notification.h>
705 notification_h noti = NULL;
706 int noti_err = NOTIFICATION_ERROR_NONE;
709 noti = notification_create(NOTIFICATION_TYPE_NOTI);
713 noti_err = notification_set_property(noti, NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE | NOTIFICATION_PROP_DISABLE_APP_LAUNCH);
714 if (noti_err != NOTIFICATION_ERROR_NONE) {
715 notification_free(noti);
721 int notification_set_property(notification_h noti, int flags);
725 * @brief Gets the property of the notification from the notification handle.
726 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
727 * @param[in] noti The notification handle
728 * @param[out] flags The notification property
729 * @return #NOTIFICATION_ERROR_NONE on success,
730 * otherwise any other value on failure
731 * @retval #NOTIFICATION_ERROR_NONE Success
732 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
735 #include <notification.h>
738 notification_h noti = NULL;
739 int noti_err = NOTIFICATION_ERROR_NONE;
742 noti_err = notification_get_property(noti, &flags);
743 if (noti_err != NOTIFICATION_ERROR_NONE)
749 int notification_get_property(notification_h noti, int *flags);
753 * @brief Sets applications to display the notification.
754 * @details All display application is enabled(NOTIFICATION_DISPLAY_APP_ALL) if you do not call this API.
755 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
756 * @param[in] noti The notification handle
757 * @param[in] applist The with | operation
758 * @return #NOTIFICATION_ERROR_NONE on success,
759 * otherwise any other value on failure
760 * @retval #NOTIFICATION_ERROR_NONE Success
761 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
764 #include <notification.h>
767 notification_h noti = NULL;
768 int noti_err = NOTIFICATION_ERROR_NONE;
771 noti = notification_create(NOTIFICATION_TYPE_NOTI);
775 noti_err = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY |
776 NOTIFICATION_DISPLAY_APP_TICKER | NOTIFICATION_DISPLAY_APP_INDICATOR);
777 if (noti_err != NOTIFICATION_ERROR_NONE) {
778 notification_free(noti);
784 int notification_set_display_applist(notification_h noti, int applist);
788 * @brief Gets the application list displaying the notification from the notification handle.
789 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
790 * @param[in] noti The notification handle
791 * @param[out] applist The display application list
792 * @return #NOTIFICATION_ERROR_NONE on success,
793 * otherwise any other value on failure
794 * @retval #NOTIFICATION_ERROR_NONE Success
795 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
798 #include <notification.h>
801 notification_h noti = NULL;
802 int noti_err = NOTIFICATION_ERROR_NONE;
805 noti_err = notification_get_display_applist(noti, &applist);
806 if (noti_err != NOTIFICATION_ERROR_NONE)
812 int notification_get_display_applist(notification_h noti, int *applist);
816 * @brief Sets the initial size for the ongoing type.
817 * @details After notification_post() call, the size is not updated.
818 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
819 * @param[in] noti The notification handle
820 * @param[in] size The double type size
821 * @return #NOTIFICATION_ERROR_NONE on success,
822 * otherwise any other value on failure
823 * @retval #NOTIFICATION_ERROR_NONE Success
824 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
827 #include <notification.h>
830 notification_h noti = NULL;
831 int noti_err = NOTIFICATION_ERROR_NONE;
833 noti = notification_create(NOTIFICATION_TYPE_NOTI);
837 noti_err = notification_set_size(noti, 0.0);
838 if (noti_err != NOTIFICATION_ERROR_NONE) {
839 notification_free(noti);
845 int notification_set_size(notification_h noti, double size);
849 * @brief Gets the progress size.
850 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
851 * @param[in] noti The notification handle
852 * @param[out] size The progress size
853 * @return #NOTIFICATION_ERROR_NONE on success,
854 * otherwise any other value on failure
855 * @retval #NOTIFICATION_ERROR_NONE Success
856 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
859 #include <notification.h>
862 notification_h noti = NULL;
863 int noti_err = NOTIFICATION_ERROR_NONE;
866 noti_err = notification_get_size(noti, &size);
867 if (noti_err != NOTIFICATION_ERROR_NONE)
872 int notification_get_size(notification_h noti, double *size);
876 * @brief Sets the initial progress for the ongoing type.
877 * @details After the notification_post() call, the progress is not updated.
878 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
879 * @param[in] noti The notification handle
880 * @param[in] percentage The progress percentage
881 * @return #NOTIFICATION_ERROR_NONE on success,
882 * otherwise any other value on failure
883 * @retval #NOTIFICATION_ERROR_NONE Success
884 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
887 #include <notification.h>
890 notification_h noti = NULL;
891 int noti_err = NOTIFICATION_ERROR_NONE;
893 noti = notification_create(NOTIFICATION_TYPE_NOTI);
897 noti_err = notification_set_progress(noti, 0.0);
898 if (noti_err != NOTIFICATION_ERROR_NONE) {
899 notification_free(noti);
905 int notification_set_progress(notification_h noti, double percentage);
909 * @brief Gets the progress from the notification handle.
910 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
911 * @remarks At the end of the operation, the progress should be @c 1.0.
912 * @param[in] noti The notification handle
913 * @param[out] percentage The progress percentage
914 * @return #NOTIFICATION_ERROR_NONE on success,
915 * otherwise any other value on failure
916 * @retval #NOTIFICATION_ERROR_NONE Success
917 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
920 #include <notification.h>
923 notification_h noti = NULL;
924 int noti_err = NOTIFICATION_ERROR_NONE;
925 double percentage = 0.0;
927 noti_err = notification_get_progress(noti, &percentage);
928 if (noti_err != NOTIFICATION_ERROR_NONE)
934 int notification_get_progress(notification_h noti, double *percentage);
938 * @brief Sets the layout of the notification view.
939 * @details Caller can set displaying layout of notification.
940 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
941 * @param[in] noti The notification handle
942 * @param[in] layout The type of layout
943 * @return #NOTIFICATION_ERROR_NONE on success,
944 * otherwise any other value on failure
945 * @retval #NOTIFICATION_ERROR_NONE Success
946 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
947 * @see #notification_ly_type_e
949 int notification_set_layout(notification_h noti, notification_ly_type_e layout);
953 * @brief Gets the layout of the notification view from the notification handle.
954 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
955 * @param[in] noti The notification handle
956 * @param[out] layout The type of layout
957 * @return #NOTIFICATION_ERROR_NONE on success,
958 * otherwise any other value on failure
959 * @retval #NOTIFICATION_ERROR_NONE Success
960 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
961 * @see #notification_ly_type_e
963 int notification_get_layout(notification_h noti, notification_ly_type_e *layout);
967 * @brief Gets the type of a notification.
968 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
969 * @param[in] noti The notification handle
970 * @param[out] type The notification type
971 * @return #NOTIFICATION_ERROR_NONE on success,
972 * otherwise any other value on failure
973 * @retval #NOTIFICATION_ERROR_NONE Success
974 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
977 #include <notification.h>
980 int noti_err = NOTIFICATION_ERROR_NONE;
981 notification_type_e type;
983 noti_err = notification_get_type(noti, &type);
984 if (noti_err != NOTIFICATION_ERROR_NONE)
989 int notification_get_type(notification_h noti, notification_type_e *type);
993 * @brief Updates notification data.
994 * @details The updated notification will appear in the notification area.
995 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
997 * @privilege %http://tizen.org/privilege/notification
998 * @param[in] noti The notification handle that is created by notification_create()
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
1003 * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Priv ID does not exist
1004 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1007 #include <notification.h>
1010 int noti_err = NOTIFICATION_ERROR_NONE;
1012 noti_err = notification_update(NULL);
1013 if (noti_err != NOTIFICATION_ERROR_NONE)
1018 int notification_update(notification_h noti);
1022 * @brief Deletes a notification with the given handle.
1023 * @details notification_delete() removes notification data from database and notification_free() releases memory of notification data.
1024 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1026 * @privilege %http://tizen.org/privilege/notification
1027 * @param[in] noti The notification handle
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 * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1035 #include <notification.h>
1038 notification_h noti = NULL;
1039 int noti_err = NOTIFICATION_ERROR_NONE;
1043 noti_err = notification_delete(noti);
1044 if (noti_err != NOTIFICATION_ERROR_NONE)
1050 int notification_delete(notification_h noti);
1054 * @brief Creates internal structure data and returns a notification handle.
1055 * @details Available type is #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING.
1056 * #NOTIFICATION_TYPE_NOTI is remaining notification data even if device is restarted.
1057 * #NOTIFICATION_TYPE_ONGOING can display progress on a notification with #NOTIFICATION_LY_ONGOING_PROGRESS layout.
1058 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1059 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1060 * @param[in] type The notification type
1061 * @return Notification handle(notification_h) on success,
1062 * otherwise @c NULL on failure
1063 * @retval notification_h Success
1064 * @retval NULL Failure
1065 * @exception #NOTIFICATION_ERROR_NONE Success
1066 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1067 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1068 * @see #notification_type_e
1071 #include <notification.h>
1074 notification_h noti = NULL;
1076 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1085 notification_h notification_create(notification_type_e type);
1089 * @brief Creates a notification clone.
1090 * @details Newly created notification handle is returned.
1091 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1092 * @remarks This cloned notification handle should be freed using notification_free().
1093 * @param[in] noti The notification handle
1094 * @param[out] clone The newly created notification handle that has same with input @a noti
1095 * @return #NOTIFICATION_ERROR_NONE if success,
1096 * otherwise any other value if failure
1097 * @retval #NOTIFICATION_ERROR_NONE Success
1098 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1099 * @see #notification_type_e
1102 #include <notification.h>
1105 notification_h noti = notification_create(NOTIFICATION_TYPE_NOTI);
1106 notification_h clone = NULL;
1108 notification_clone(noti, &clone);
1115 int notification_clone(notification_h noti, notification_h *clone);
1119 * @brief Frees the internal structure data of a notification handle.
1120 * @details Internal data of a notification handle is released. Data of the inserted notification is not deleted.
1121 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1122 * @param[in] noti The notification handle
1123 * @return #NOTIFICATION_ERROR_NONE on success,
1124 * otherwise any other value on failure
1125 * @retval #NOTIFICATION_ERROR_NONE Success
1126 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1127 * @pre Notification handle should be created by notification_create().
1130 #include <notification.h>
1133 notification_h noti = NULL;
1134 int noti_err = NOTIFICATION_ERROR_NONE;
1136 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1142 noti_err = notification_free(noti);
1143 if (noti_err != NOTIFICATION_ERROR_NONE)
1149 int notification_free(notification_h noti);
1158 * @addtogroup NOTIFICATION_MODULE
1164 * @brief Sets the tag of the notification handle.
1165 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1166 * @param[in] noti Notification handle
1167 * @param[in] tag Tag for loading notification handle
1168 * @return #NOTIFICATION_ERROR_NONE on success,
1169 * other value on failure
1170 * @retval #NOTIFICATION_ERROR_NONE Success
1171 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1172 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1173 * @see notification_get_tag()
1176 #include <notification.h>
1179 notification_h noti = NULL;
1180 int noti_err = NOTIFICATION_ERROR_NONE;
1182 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1188 noti_err = notification_set_tag(noti, tag);
1189 if (noti_err != NOTIFICATION_ERROR_NONE)
1195 int notification_set_tag(notification_h noti, const char *tag);
1199 * @brief Gets the tag of the notification handle.
1200 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1201 * @param[in] noti Notification handle
1202 * @param[out] tag Tag for loading notification handle
1203 * @return #NOTIFICATION_ERROR_NONE on success,
1204 * other value on failure
1205 * @retval #NOTIFICATION_ERROR_NONE Success
1206 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1207 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1208 * @see notification_set_tag()
1211 #include <notification.h>
1214 int noti_err = NOTIFICATION_ERROR_NONE;
1215 const char *tag = NULL;
1219 noti_err = notification_get_tag(noti, &tag);
1220 if (noti_err != NOTIFICATION_ERROR_NONE)
1226 int notification_get_tag(notification_h noti, const char **tag);
1230 * @brief Loads a notification from the notification's database with the tag.
1231 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1233 * @privilege %http://tizen.org/privilege/notification
1234 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1235 * @param[in] tag Tag for loading notification handle
1236 * @return Notification handle(notification_h) on success,
1238 * @retval notification_h Success
1239 * @retval NULL Failure
1240 * @exception #NOTIFICATION_ERROR_NONE Success
1241 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1242 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1243 * @exception #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1244 * @see #notification_type_e
1247 #include <notification.h>
1250 notification_h noti = NULL;
1252 noti = notification_load_by_tag(tag);
1261 notification_h notification_load_by_tag(const char *tag);
1265 * @brief Deletes all notifications of the given type.
1266 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1268 * @privilege %http://tizen.org/privilege/notification
1269 * @param[in] type Notification type
1270 * @return #NOTIFICATION_ERROR_NONE if success,
1271 * other value if failure
1272 * @retval #NOTIFICATION_ERROR_NONE Success
1273 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1274 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1277 #include <notification.h>
1280 int noti_err = NOTIFICATION_ERROR_NONE;
1282 noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
1283 if (noti_err != NOTIFICATION_ERROR_NONE)
1289 int notification_delete_all(notification_type_e type);
1293 * @brief Posts a notification.
1294 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1296 * @privilege %http://tizen.org/privilege/notification
1297 * @param[in] noti Notification handle
1298 * @return #NOTIFICATION_ERROR_NONE if success,
1299 * 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);
1323 * @brief Gets the package name of the notification.
1324 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1325 * @param[in] noti Notification handle
1326 * @param[out] pkgname The package name of the notification
1327 * @return #NOTIFICATION_ERROR_NONE on success,
1328 * otherwise a negative error value
1329 * @retval NOTIFICATION_ERROR_NONE Success
1330 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1333 #include <notification.h>
1336 notification_h noti = NULL;
1337 int noti_err = NOTIFICATION_ERROR_NONE;
1338 char *pkgname = NULL;
1342 noti_err = notification_get_pkgname(noti, &pkgname);
1344 if (noti_err != NOTIFICATION_ERROR_NONE) {
1345 notification_free(noti);
1351 int notification_get_pkgname(notification_h noti, char **pkgname);
1355 * @brief Adds a button on the notification.
1356 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1357 * @param[in] noti Notification handle
1358 * @param[in] button_index Button index
1359 * @return #NOTIFICATION_ERROR_NONE on success,
1360 * otherwise a negative error value
1361 * @retval NOTIFICATION_ERROR_NONE Success
1362 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1365 #include <notification.h>
1368 notification_h noti = NULL;
1369 int noti_err = NOTIFICATION_ERROR_NONE;
1370 char *pkgname = NULL;
1374 noti_err = notification_add_button(noti, NOTIFICATION_BUTTON_1);
1376 if (noti_err != NOTIFICATION_ERROR_NONE) {
1377 notification_free(noti);
1383 int notification_add_button(notification_h noti, notification_button_index_e button_index);
1386 * @brief Removes a button on the notification.
1387 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1388 * @param[in] noti Notification handle
1389 * @param[in] button_index Button index
1390 * @return #NOTIFICATION_ERROR_NONE on success,
1391 * otherwise a negative error value
1392 * @retval NOTIFICATION_ERROR_NONE Success
1393 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1396 #include <notification.h>
1399 notification_h noti = NULL;
1400 int noti_err = NOTIFICATION_ERROR_NONE;
1401 char *pkgname = NULL;
1405 noti_err = notification_remove_button(noti, NOTIFICATION_BUTTON_1);
1407 if (noti_err != NOTIFICATION_ERROR_NONE) {
1408 notification_free(noti);
1414 int notification_remove_button(notification_h noti, notification_button_index_e button_index);
1418 * @brief Sets the 'auto remove' option of the active notification.
1419 * @details The 'auto remove' option lets the active notification be removed several seconds after it shows. Default value is true.
1420 * @remarks When 'auto_remove' is set as false, the active notification will not be removed
1421 * as long as the user removes the active notification or the app which posted the active notification removes the active notification.
1422 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1423 * @param[in] noti Notification handle
1424 * @param[in] auto_remove Auto remove option
1425 * @return #NOTIFICATION_ERROR_NONE On success,
1426 * other value if failure
1427 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1428 * @see #notification_h
1429 * @see #notification_get_auto_remove
1432 #include <notification.h>
1435 notification_h noti = NULL;
1436 int noti_err = NOTIFICATION_ERROR_NONE;
1440 noti_err = notification_set_auto_remove(noti, false);
1441 if (noti_err != NOTIFICATION_ERROR_NONE)
1447 int notification_set_auto_remove(notification_h noti, bool auto_remove);
1451 * @brief Gets the 'auto remove' option of the active notification.
1452 * @details The 'auto remove' option lets the active notification be removed several seconds after it shows. Default value is true.
1453 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1454 * @param[in] noti Notification handle
1455 * @param[out] auto_remove Auto remove option
1456 * @return #NOTIFICATION_ERROR_NONE On success, other value on failure
1457 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1458 * @see #notification_h
1459 * @see #notification_get_auto_remove
1462 #include <notification.h>
1465 int noti_err = NOTIFICATION_ERROR_NONE;
1470 noti_err = notification_get_auto_remove(noti, &auto_remove);
1471 if (noti_err != NOTIFICATION_ERROR_NONE)
1477 int notification_get_auto_remove(notification_h noti, bool *auto_remove);
1481 * @brief Saves a notification template to the notification database.
1482 * @details An application can save the created notification as a template for later reuse.
1483 * If the template has the same name as a saved one, the saved template will be overwritten.
1484 * A saved template can be loaded only by the application which saved it.
1485 * All templates are removed when the application package is uninstalled.
1488 * @privilege %http://tizen.org/privilege/notification
1489 * @remarks The number of templates is limited to 10.
1490 * When you try to add more than 10 templates, #NOTIFICATION_ERROR_MAX_EXCEEDED will be returned.
1491 * @param[in] noti Notification handle
1492 * @param[in] template_name Template name
1493 * @return #NOTIFICATION_ERROR_NONE On success, other value on failure
1494 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1495 * @retval #NOTIFICATION_ERROR_IO_ERROR I/O error
1496 * @retval #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1497 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The Permission denied
1498 * @retval #NOTIFICATION_ERROR_MAX_EXCEEDED Max notification count exceeded
1499 * @see #notification_h
1500 * @see notification_create_from_template()
1503 #include <notification.h>
1506 int noti_err = NOTIFICATION_ERROR_NONE;
1510 noti_err = notification_save_as_template(noti, "CALL_ACCEPT");
1511 if (noti_err != NOTIFICATION_ERROR_NONE)
1517 int notification_save_as_template(notification_h noti, const char *template_name);
1521 * @brief Loads a notification template from the notification database.
1522 * @details An application can load a saved template and post it.
1523 * An application can load only templates that it has saved.
1526 * @privilege %http://tizen.org/privilege/notification
1527 * @remarks The returned handle should be destroyed using notification_free().
1528 * The specific error code can be obtained using get_last_result().
1529 * Error codes are described in the Exception section.
1530 * If an invalid template name is given, the result will be set to #NOTIFICATION_ERROR_FROM_DB.
1531 * @param[in] template_name Template name
1532 * @return Notification handle on success, NULL on failure
1533 * @exception #NOTIFICATION_ERROR_NONE Success
1534 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1535 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1536 * @exception #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1537 * @exception #NOTIFICATION_ERROR_FROM_DB Error from DB query
1538 * @see #notification_h
1539 * @see notification_save_as_template()
1542 #include <notification.h>
1545 notification_h noti = NULL;
1547 noti = notification_create_from_template("CALL_ACCEPT");
1554 notification_h notification_create_from_template(const char *template_name);
1558 * @brief Gets notification block state.
1559 * @details The user can set the notification block state in settings.
1560 * The block state indicates whether or not notifications can be posted.
1561 * Additionally only notifications to the notification panel are
1562 * allowed in "Do not disturb mode". Sound, Vibrate and
1563 * Active/Instant notifications are blocked.
1566 * @privilege %http://tizen.org/privilege/notification
1567 * @param[out] state Notification block state
1568 * @return #NOTIFICATION_ERROR_NONE On success, other value on failure
1569 * @retval #NOTIFICATION_ERROR_NONE Success
1570 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1571 * @retval #NOTIFICATION_ERROR_OUT_OF_MEMORY out of memory
1572 * @retval #NOTIFICATION_ERROR_IO_ERROR I/O Error
1573 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED Permission denied
1574 * @retval #NOTIFICATION_ERROR_SERVICE_NOT_READY No response from notification service
1575 * @see #notification_block_state_e
1578 #include <notification.h>
1581 int noti_err = NOTIFICATION_ERROR_NONE;
1582 notification_block_state_e state;
1586 noti_err = notification_get_noti_block_state(&state);
1587 if (noti_err != NOTIFICATION_ERROR_NONE)
1593 int notification_get_noti_block_state(notification_block_state_e *state);
1597 * @brief Sets a text input box to reply directly on the notification.
1598 * @details When you add a text input to the active notification, the notification UI will show a text input with a button.
1599 * So, the user can enter any text and press the button to confirm the text as a input.
1600 * You can edit some UI component that is related to the text input.
1601 * First, you can add placeholder text to guide the user using notification_set_text() with #NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER type.
1602 * You also can edit button for the text input.
1603 * For setting just a text to the button, you can set the text using notification_set_text() with #NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON type.
1604 * If you want to show image button, you can set an image for the button using notification_set_image() with #NOTIFICATION_IMAGE_TYPE_TEXT_INPUT_BUTTON type.
1606 * Note that you should set an app_control for handling the event for user input using notification_set_event_handler().
1607 * #NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON is the event type for the text input.
1608 * You can get the text the user enters in the app_control handle that is passed as a result of the event.
1609 * The app_control will contain APP_CONTROL_DATA_TEXT key, so you can get the text using app_control_get_extra_data() using APP_CONTROL_DATA_TEXT key.
1610 * The value will contain the text user enters.
1612 * Note that you are able to make the switching button to the text input box.
1613 * You have to set the app_control which you will set in a text input box to the switching button.
1614 * Refer to the second sample code.
1616 * @param[in] noti Notification handle
1617 * @param[in] text_input_max_length The maximum value which can be inputted
1618 * @return #NOTIFICATION_ERROR_NONE on success,
1619 * otherwise any other value on failure
1620 * @retval #NOTIFICATION_ERROR_NONE Success
1621 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1624 #include <notification.h>
1627 int noti_err = NOTIFICATION_ERROR_NONE;
1628 notification_h noti = NULL;
1631 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1635 noti_err = notification_set_text_input(noti, 160);
1636 if (noti_err != NOTIFICATION_ERROR_NONE)
1639 noti_err = notification_set_text(noti,
1640 NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER,
1643 NOTIFICATION_VARIABLE_TYPE_NONE);
1644 if (noti_err != NOTIFICATION_ERROR_NONE)
1647 noti_err = notification_set_text(noti,
1648 NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON,
1651 NOTIFICATION_VARIABLE_TYPE_NONE);
1652 if (noti_err != NOTIFICATION_ERROR_NONE)
1655 noti_err = notification_set_display_applist(noti,
1656 NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_ACTIVE);
1657 if (noti_err != NOTIFICATION_ERROR_NONE)
1662 noti_err = app_control_create(&app_control);
1663 if (noti_err != APP_CONTROL_ERROR_NONE)
1666 noti_err = app_control_set_app_id(app_control, appid);
1667 if (noti_err != APP_CONTROL_ERROR_NONE)
1670 noti_err = app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
1671 if (noti_err != APP_CONTROL_ERROR_NONE)
1674 noti_err = notification_set_event_handler(noti,
1675 NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON,
1677 if (noti_err != NOTIFICATION_ERROR_NONE)
1680 noti_err = app_control_destroy(app_control);
1681 if (noti_err != APP_CONTROL_ERROR_NONE)
1684 noti_err = notification_post(noti);
1685 if(noti_err != NOTIFICATION_ERROR_NONE)
1692 int noti_err = NOTIFICATION_ERROR_NONE;
1693 notification_h noti = NULL;
1696 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1701 noti_err = notification_set_text_input(noti, 160);
1702 if (noti_err != NOTIFICATION_ERROR_NONE)
1705 noti_err = notification_set_text(noti,
1706 NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER,
1709 NOTIFICATION_VARIABLE_TYPE_NONE);
1710 if (noti_err != NOTIFICATION_ERROR_NONE)
1713 noti_err = notification_set_text(noti,
1714 NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON,
1717 NOTIFICATION_VARIABLE_TYPE_NONE);
1718 if (noti_err != NOTIFICATION_ERROR_NONE)
1721 noti_err = notification_add_button(notification, NOTIFICATION_BUTTON_1);
1722 if (noti_err != NOTIFICATION_ERROR_NONE)
1725 noti_err = notification_set_text(notification,
1726 NOTIFICATION_TEXT_TYPE_BUTTON_1,
1729 NOTIFICATION_VARIABLE_TYPE_NONE);
1730 if (noti_err != NOTIFICATION_ERROR_NONE)
1733 noti_err = notification_set_display_applist(noti,
1734 NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_ACTIVE);
1735 if (noti_err != NOTIFICATION_ERROR_NONE)
1740 noti_err = app_control_create(&app_control);
1741 if (noti_err != APP_CONTROL_ERROR_NONE)
1744 noti_err = app_control_set_app_id(app_control, appid);
1745 if (noti_err != APP_CONTROL_ERROR_NONE)
1748 noti_err = app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
1749 if (noti_err != APP_CONTROL_ERROR_NONE)
1752 noti_err = notification_set_event_handler(notification,
1753 NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1,
1755 if (noti_err != NOTIFICATION_ERROR_NONE)
1758 noti_err = notification_set_event_handler(noti,
1759 NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON,
1761 if (noti_err != NOTIFICATION_ERROR_NONE)
1764 noti_err = app_control_destroy(app_control);
1765 if (noti_err != APP_CONTROL_ERROR_NONE)
1768 noti_err = notification_post(noti);
1769 if(noti_err != NOTIFICATION_ERROR_NONE)
1774 int notification_set_text_input(notification_h noti, int text_input_max_length);
1778 * @brief Sets the image height for the extended notification.
1779 * @details The image is shown under the notification's text. The application can set the image height.
1780 * The image is modified to fit into the height set by this function.
1781 * The image can be scaled down and/or cropped.
1782 * If @a height is 0, the default value is used. The default height depends on the screen size.
1784 * @param[in] noti The notification handle
1785 * @param[in] height The image height
1786 * @return #NOTIFICATION_ERROR_NONE On success,
1787 * otherwise a negative error value
1788 * @retval #NOTIFICATION_ERROR_NONE Success
1789 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1790 * @see notification_get_extension_image_size()
1793 #include <notification.h>
1796 notification_h noti = NULL;
1797 int noti_err = NOTIFICATION_ERROR_NONE;
1799 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1803 noti_err = notification_set_text(noti,
1804 NOTIFICATION_TEXT_TYPE_CONTENT_EXTENTION,
1807 NOTIFICATION_VARIABLE_TYPE_NONE);
1808 if (noti_err != NOTIFICATION_ERROR_NONE)
1811 noti_err = notification_set_image(noti,
1812 NOTIFICATION_IMAGE_TYPE_EXTENTION,
1814 if (noti_err != NOTIFICATION_ERROR_NONE)
1817 noti_err = notification_set_layout(noti, NOTIFICATION_LY_EXTENTION);
1818 if (noti_err != NOTIFICATION_ERROR_NONE)
1821 noti_err = notification_set_extension_image_size(noti, 20);
1822 if (noti_err != NOTIFICATION_ERROR_NONE)
1829 int notification_set_extension_image_size(notification_h noti, int height);
1833 * @brief Gets the image height for the extended notification.
1835 * @param[in] noti The notification handle
1836 * @param[out] height The image height
1837 * @return #NOTIFICATION_ERROR_NONE On success, otherwise a negative error value
1838 * @retval #NOTIFICATION_ERROR_NONE Success
1839 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1840 * @see notification_set_extension_image_size()
1843 #include <notification.h>
1846 int noti_err = NOTIFICATION_ERROR_NONE;
1851 noti_err = notification_get_extension_image_size(noti, &height);
1852 if (noti_err != NOTIFICATION_ERROR_NONE)
1857 int notification_get_extension_image_size(notification_h noti, int *height);
1866 #endif /* __NOTIFICATION_H__ */