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.
220 * Note that You can display the translated contents according to the language of the system.
221 * The application must supply a String KEY as the fourth argument to support localization.
222 * If the language on the system changes, the contents of the notification are also translated.
224 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
225 * @param[in] noti The notification handle
226 * @param[in] type The notification text type
227 * @param[in] text The basic text
228 * @param[in] key The text key for localization
229 * @param[in] args_type The variable parameter that type - value pair
230 * @return #NOTIFICATION_ERROR_NONE on success,
231 * otherwise any other value on failure
232 * @retval #NOTIFICATION_ERROR_NONE Success
233 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
234 * @pre notification handle should be created by notification_create().
237 #include <notification.h>
240 notification_h noti = NULL;
241 int noti_err = NOTIFICATION_ERROR_NONE;
243 noti = notification_create(NOTIFICATION_TYPE_NOTI);
247 noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
248 "I'm Title", "IDS_APP_BODY_IM_TITLE", NOTIFICATION_VARIABLE_TYPE_NONE);
249 if (noti_err != NOTIFICATION_ERROR_NONE) {
250 notification_free(noti);
256 int notification_set_text(notification_h noti, notification_text_type_e type,
257 const char *text, const char *key, int args_type, ...);
261 * @brief Gets the text from the notification handle.
262 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
263 * @param[in] noti The notification handle
264 * @param[in] type The notification text type
265 * @param[out] text The notification text
266 * @return #NOTIFICATION_ERROR_NONE on success,
267 * otherwise any other value on failure
268 * @retval #NOTIFICATION_ERROR_NONE Success
269 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
272 #include <notification.h>
275 notification_h noti = NULL;
276 int noti_err = NOTIFICATION_ERROR_NONE;
279 noti_err = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, &text);
280 if (noti_err != NOTIFICATION_ERROR_NONE)
286 int notification_get_text(notification_h noti, notification_text_type_e type, char **text);
290 * @brief Sets the timestamp to display on the notification view.
291 * @details The timestamp will be converted to a formatted string and it will be displayed on the set text area.
292 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
293 * @param[in] noti The notification handle
294 * @param[in] type The notification text type
295 * @param[in] time The timestamp
296 * @return #NOTIFICATION_ERROR_NONE on success,
297 * otherwise any other value on failure
298 * @retval #NOTIFICATION_ERROR_NONE Success
299 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
300 * @pre Notification handle should be created by notification_create().
302 int notification_set_time_to_text(notification_h noti, notification_text_type_e type, time_t time);
306 * @brief Gets the timestamp from the notification handle.
307 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
308 * @param[in] noti The notification handle
309 * @param[in] type The notification text type
310 * @param[in] time The pointer of time stamp
311 * @return #NOTIFICATION_ERROR_NONE on success,
312 * otherwise any other value on failure
313 * @retval #NOTIFICATION_ERROR_NONE Success
314 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
315 * @pre Notification handle should be created by notification_create().
317 int notification_get_time_from_text(notification_h noti, notification_text_type_e type, time_t *time);
321 * @brief Sets the sound type for the notification.
322 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
323 * @param[in] noti The notification handle
324 * @param[in] type The notification sound type
325 * @param[in] path The user sound file path
326 * @return #NOTIFICATION_ERROR_NONE on success,
327 * otherwise any other value on failure
328 * @retval #NOTIFICATION_ERROR_NONE Success
329 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
332 #include <notification.h>
335 notification_h noti = NULL;
336 int noti_err = NOTIFICATION_ERROR_NONE;
338 noti_err = notification_set_sound(noti, NOTIFICATION_SOUND_TYPE_DEFAULT, NULL);
339 if (noti_err != NOTIFICATION_ERROR_NONE)
345 int notification_set_sound(notification_h noti, notification_sound_type_e type, const char *path);
349 * @brief Gets the sound type from the notification handle.
350 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
351 * @param[in] noti The notification handle
352 * @param[out] type The notification sound type
353 * @param[out] path The user sound file path
354 * @return #NOTIFICATION_ERROR_NONE on success,
355 * otherwise any other value on failure
356 * @retval #NOTIFICATION_ERROR_NONE Success
357 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
360 #include <notification.h>
363 notification_h noti = NULL;
364 int noti_err = NOTIFICATION_ERROR_NONE;
365 notification_sound_type_e type = NOTIFICATION_SOUND_TYPE_NONE;
367 noti_err = notification_get_sound(noti, &type, NULL);
368 if (noti_err != NOTIFICATION_ERROR_NONE)
374 int notification_get_sound(notification_h noti, notification_sound_type_e *type, const char **path);
378 * @brief Sets the vibration type for the notification.
379 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
380 * @param[in] noti The notification handle
381 * @param[in] type The notification vibration type
382 * @param[in] path The user vibration file path
383 * @return #NOTIFICATION_ERROR_NONE on success,
384 * otherwise any other value on failure
385 * @retval #NOTIFICATION_ERROR_NONE Success
386 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
389 #include <notification.h>
392 notification_h noti = NULL;
393 int noti_err = NOTIFICATION_ERROR_NONE;
395 noti_err = notification_set_vibration(noti, NOTIFICATION_VIBRATION_TYPE_DEFAULT, NULL);
396 if (noti_err != NOTIFICATION_ERROR_NONE)
402 int notification_set_vibration(notification_h noti, notification_vibration_type_e type, const char *path);
406 * @brief Gets the vibrate type from the notification handle.
407 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
408 * @param[in] noti The notification handle
409 * @param[out] type The notification sound type
410 * @param[out] path The user vibration file path
411 * @return #NOTIFICATION_ERROR_NONE on success,
412 * otherwise other value on failure
413 * @retval #NOTIFICATION_ERROR_NONE Success
414 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
417 #include <notification.h>
420 notification_h noti = NULL;
421 int noti_err = NOTIFICATION_ERROR_NONE;
422 notification_vibration_type_e type = NOTIFICATION_VIBRATION_TYPE_NONE;
424 noti_err = notification_get_vibration(noti, &type, NULL);
425 if (noti_err != NOTIFICATION_ERROR_NONE)
431 int notification_get_vibration(notification_h noti, notification_vibration_type_e *type, const char **path);
435 * @brief Sets the LED displaying option.
436 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
437 * @param[in] noti The notification handle
438 * @param[in] operation The LED notification operation
439 * @param[in] led_argb The notification LED color
440 * @return #NOTIFICATION_ERROR_NONE on success,
441 * otherwise other value on failure
442 * @retval #NOTIFICATION_ERROR_NONE Success
443 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
446 #include <notification.h>
449 notification_h noti = NULL;
450 int noti_err = NOTIFICATION_ERROR_NONE;
452 noti_err = notification_set_led(noti, NOTIFICATION_LED_OP_ON, NULL);
453 if (noti_err != NOTIFICATION_ERROR_NONE)
459 int notification_set_led(notification_h noti, notification_led_op_e operation, int led_argb);
463 * @brief Gets the LED displaying option from the notification handle.
464 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
465 * @param[in] noti The notification handle
466 * @param[out] operation The LED notification operation
467 * @param[out] led_argb The notification LED color
468 * @return #NOTIFICATION_ERROR_NONE on success,
469 * otherwise any other value on failure
470 * @retval #NOTIFICATION_ERROR_NONE Success
471 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
474 #include <notification.h>
477 notification_h noti = NULL;
478 int noti_err = NOTIFICATION_ERROR_NONE;
479 notification_led_type_e type = NOTIFICATION_LED_OP_OFF;
481 noti_err = notification_get_led(noti, &type, NULL);
482 if (noti_err != NOTIFICATION_ERROR_NONE)
488 int notification_get_led(notification_h noti, notification_led_op_e *operation, int *led_argb);
492 * @brief Sets the time period of flashing the LED.
493 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
494 * @param[in] noti The notification handle
495 * @param[in] on_ms The time for turning on the LED
496 * @param[in] off_ms The time for turning off the LED
497 * @return #NOTIFICATION_ERROR_NONE on success,
498 * otherwise any other value on failure
499 * @retval #NOTIFICATION_ERROR_NONE Success
500 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
503 #include <notification.h>
506 notification_h noti = NULL;
507 int noti_err = NOTIFICATION_ERROR_NONE;
509 noti_err = notification_set_led_time_period(noti, 100, 100);
510 if (noti_err != NOTIFICATION_ERROR_NONE)
516 int notification_set_led_time_period(notification_h noti, int on_ms, int off_ms);
520 * @brief Gets the time period of flashing the LED from the notification handle.
521 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
522 * @param[in] noti The notification handle
523 * @param[out] on_ms The time for turning on the LED
524 * @param[out] off_ms The time for turning on the LED
525 * @return #NOTIFICATION_ERROR_NONE on success,
526 * otherwise any other value on failure
527 * @retval #NOTIFICATION_ERROR_NONE Success
528 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
531 #include <notification.h>
534 notification_h noti = NULL;
535 int noti_err = NOTIFICATION_ERROR_NONE;
539 noti_err = notification_get_led_time_period(noti, &led_on_ms, &led_off_ms);
540 if (noti_err != NOTIFICATION_ERROR_NONE)
546 int notification_get_led_time_period(notification_h noti, int *on_ms, int *off_ms);
550 * @brief Sets the launch option for a notification.
551 * @details When notification data selected in display application, application launched by app_control_send_launch_request with app_control handle.
552 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
553 * @param[in] noti The notification handle
554 * @param[in] type Launching option type
555 * @param[in] option App Control handler
556 * @return #NOTIFICATION_ERROR_NONE on success,
557 * otherwise any other value on failure
558 * @retval #NOTIFICATION_ERROR_NONE Success
559 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
562 #include <notification.h>
565 notification_h noti = NULL;
566 app_control_h app_control = NULL;
567 int noti_err = NOTIFICATION_ERROR_NONE;
571 app_control_create(&app_control);
572 app_control_set_app_id(app_control, "org.tizen.app");
576 noti_err = notification_set_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)app_control);
577 if (noti_err != NOTIFICATION_ERROR_NONE) {
578 app_control_destroy(app_control);
579 notification_free(noti);
583 app_control_destroy(app_control);
587 int notification_set_launch_option(notification_h noti, notification_launch_option_type type, void *option);
591 * @brief Gets the launch option from the notification handle.
592 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
593 * @remarks You must release @a app_control using app_control_destroy().
594 * @param[in] noti The notification handle
595 * @param[in] type Launching option type
596 * @param[out] option The pointer of App Control handler
597 * @return #NOTIFICATION_ERROR_NONE on success,
598 * otherwise any other value on failure
599 * @retval #NOTIFICATION_ERROR_NONE Success
600 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
603 #include <notification.h>
606 app_control_h app_control = NULL;
607 app_control_create(&app_control);
611 noti_err = notification_get_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)&app_control);
612 if (noti_err != NOTIFICATION_ERROR_NONE)
617 int notification_get_launch_option(notification_h noti, notification_launch_option_type type, void *option);
621 * @brief Sets the handler for a specific event.
622 * @details When some event occurs on notification, application launched by app_control_send_launch_request with app_control handle. \n
623 * Setting event handler of a button means that the notification will show the button.
624 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
625 * @param[in] noti The notification handle
626 * @param[in] event_type Event type
627 * @param[in] event_handler App control handle
628 * @return #NOTIFICATION_ERROR_NONE on success,
629 * otherwise any other value on failure
630 * @retval #NOTIFICATION_ERROR_NONE Success
631 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
632 * @see #notification_event_type_e
635 #include <notification.h>
638 notification_h noti = NULL;
639 app_control_h app_control = NULL;
640 int noti_err = NOTIFICATION_ERROR_NONE;
644 app_control_create(&app_control);
645 app_control_set_app_id(app_control, "org.tizen.app");
649 noti_err = notification_set_event_handler(noti, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, app_control);
650 if (noti_err != NOTIFICATION_ERROR_NONE) {
651 app_control_destroy(app_control);
652 notification_free(noti);
656 app_control_destroy(app_control);
660 int notification_set_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h event_handler);
664 * @brief Gets the event handler of a specific event.
665 * @remarks You must release @a app_control using app_control_destroy().
666 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
667 * @param[in] noti The notification handle
668 * @param[in] event_type Launching option type
669 * @param[out] event_handler The handler of App Control
670 * @return #NOTIFICATION_ERROR_NONE on success,
671 * otherwise any other value on failure
672 * @retval #NOTIFICATION_ERROR_NONE Success
673 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
674 * @see #notification_event_type_e
677 #include <notification.h>
680 app_control_h app_control = NULL;
681 app_control_create(&app_control);
685 noti_err = notification_get_event_handler(noti, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, &app_control);
686 if (noti_err != NOTIFICATION_ERROR_NONE) {
687 notification_free(noti);
693 int notification_get_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h *event_handler);
697 * @brief Sets the property of the notification.
698 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
699 * @param[in] noti The notification handle
700 * @param[in] flags The property with | operation
701 * @return #NOTIFICATION_ERROR_NONE on success,
702 * otherwise any other value on failure
703 * @retval #NOTIFICATION_ERROR_NONE Success
704 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
707 #include <notification.h>
710 notification_h noti = NULL;
711 int noti_err = NOTIFICATION_ERROR_NONE;
714 noti = notification_create(NOTIFICATION_TYPE_NOTI);
718 noti_err = notification_set_property(noti, NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE | NOTIFICATION_PROP_DISABLE_APP_LAUNCH);
719 if (noti_err != NOTIFICATION_ERROR_NONE) {
720 notification_free(noti);
726 int notification_set_property(notification_h noti, int flags);
730 * @brief Gets the property of the notification from the notification handle.
731 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
732 * @param[in] noti The notification handle
733 * @param[out] flags The notification property
734 * @return #NOTIFICATION_ERROR_NONE on success,
735 * otherwise any other value on failure
736 * @retval #NOTIFICATION_ERROR_NONE Success
737 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
740 #include <notification.h>
743 notification_h noti = NULL;
744 int noti_err = NOTIFICATION_ERROR_NONE;
747 noti_err = notification_get_property(noti, &flags);
748 if (noti_err != NOTIFICATION_ERROR_NONE)
754 int notification_get_property(notification_h noti, int *flags);
758 * @brief Sets applications to display the notification.
759 * @details All display application is enabled(NOTIFICATION_DISPLAY_APP_ALL) if you do not call this API.
760 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
761 * @param[in] noti The notification handle
762 * @param[in] applist The with | operation
763 * @return #NOTIFICATION_ERROR_NONE on success,
764 * otherwise any other value on failure
765 * @retval #NOTIFICATION_ERROR_NONE Success
766 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
769 #include <notification.h>
772 notification_h noti = NULL;
773 int noti_err = NOTIFICATION_ERROR_NONE;
776 noti = notification_create(NOTIFICATION_TYPE_NOTI);
780 noti_err = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY |
781 NOTIFICATION_DISPLAY_APP_TICKER | NOTIFICATION_DISPLAY_APP_INDICATOR);
782 if (noti_err != NOTIFICATION_ERROR_NONE) {
783 notification_free(noti);
789 int notification_set_display_applist(notification_h noti, int applist);
793 * @brief Gets the application list displaying the notification from the notification handle.
794 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
795 * @param[in] noti The notification handle
796 * @param[out] applist The display application list
797 * @return #NOTIFICATION_ERROR_NONE on success,
798 * otherwise any other value on failure
799 * @retval #NOTIFICATION_ERROR_NONE Success
800 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
803 #include <notification.h>
806 notification_h noti = NULL;
807 int noti_err = NOTIFICATION_ERROR_NONE;
810 noti_err = notification_get_display_applist(noti, &applist);
811 if (noti_err != NOTIFICATION_ERROR_NONE)
817 int notification_get_display_applist(notification_h noti, int *applist);
821 * @brief Sets the initial size for the ongoing type.
822 * @details After notification_post() call, the size is not updated.
823 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
824 * @param[in] noti The notification handle
825 * @param[in] size The double type size
826 * @return #NOTIFICATION_ERROR_NONE on success,
827 * otherwise any other value on failure
828 * @retval #NOTIFICATION_ERROR_NONE Success
829 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
832 #include <notification.h>
835 notification_h noti = NULL;
836 int noti_err = NOTIFICATION_ERROR_NONE;
838 noti = notification_create(NOTIFICATION_TYPE_NOTI);
842 noti_err = notification_set_size(noti, 0.0);
843 if (noti_err != NOTIFICATION_ERROR_NONE) {
844 notification_free(noti);
850 int notification_set_size(notification_h noti, double size);
854 * @brief Gets the progress size.
855 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
856 * @param[in] noti The notification handle
857 * @param[out] size The progress size
858 * @return #NOTIFICATION_ERROR_NONE on success,
859 * otherwise any other value on failure
860 * @retval #NOTIFICATION_ERROR_NONE Success
861 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
864 #include <notification.h>
867 notification_h noti = NULL;
868 int noti_err = NOTIFICATION_ERROR_NONE;
871 noti_err = notification_get_size(noti, &size);
872 if (noti_err != NOTIFICATION_ERROR_NONE)
877 int notification_get_size(notification_h noti, double *size);
881 * @brief Sets the initial progress for the ongoing type.
882 * @details After the notification_post() call, the progress is not updated.
883 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
884 * @param[in] noti The notification handle
885 * @param[in] percentage The progress percentage
886 * @return #NOTIFICATION_ERROR_NONE on success,
887 * otherwise any other value on failure
888 * @retval #NOTIFICATION_ERROR_NONE Success
889 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
892 #include <notification.h>
895 notification_h noti = NULL;
896 int noti_err = NOTIFICATION_ERROR_NONE;
898 noti = notification_create(NOTIFICATION_TYPE_NOTI);
902 noti_err = notification_set_progress(noti, 0.0);
903 if (noti_err != NOTIFICATION_ERROR_NONE) {
904 notification_free(noti);
910 int notification_set_progress(notification_h noti, double percentage);
914 * @brief Gets the progress from the notification handle.
915 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
916 * @remarks At the end of the operation, the progress should be @c 1.0.
917 * @param[in] noti The notification handle
918 * @param[out] percentage The progress percentage
919 * @return #NOTIFICATION_ERROR_NONE on success,
920 * otherwise any other value on failure
921 * @retval #NOTIFICATION_ERROR_NONE Success
922 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
925 #include <notification.h>
928 notification_h noti = NULL;
929 int noti_err = NOTIFICATION_ERROR_NONE;
930 double percentage = 0.0;
932 noti_err = notification_get_progress(noti, &percentage);
933 if (noti_err != NOTIFICATION_ERROR_NONE)
939 int notification_get_progress(notification_h noti, double *percentage);
943 * @brief Sets the layout of the notification view.
944 * @details Caller can set displaying layout of notification.
945 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
946 * @param[in] noti The notification handle
947 * @param[in] layout The type of layout
948 * @return #NOTIFICATION_ERROR_NONE on success,
949 * otherwise any other value on failure
950 * @retval #NOTIFICATION_ERROR_NONE Success
951 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
952 * @see #notification_ly_type_e
954 int notification_set_layout(notification_h noti, notification_ly_type_e layout);
958 * @brief Gets the layout of the notification view from the notification handle.
959 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
960 * @param[in] noti The notification handle
961 * @param[out] layout The type of layout
962 * @return #NOTIFICATION_ERROR_NONE on success,
963 * otherwise any other value on failure
964 * @retval #NOTIFICATION_ERROR_NONE Success
965 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
966 * @see #notification_ly_type_e
968 int notification_get_layout(notification_h noti, notification_ly_type_e *layout);
972 * @brief Gets the type of a notification.
973 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
974 * @param[in] noti The notification handle
975 * @param[out] type The notification type
976 * @return #NOTIFICATION_ERROR_NONE on success,
977 * otherwise any other value on failure
978 * @retval #NOTIFICATION_ERROR_NONE Success
979 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
982 #include <notification.h>
985 int noti_err = NOTIFICATION_ERROR_NONE;
986 notification_type_e type;
988 noti_err = notification_get_type(noti, &type);
989 if (noti_err != NOTIFICATION_ERROR_NONE)
994 int notification_get_type(notification_h noti, notification_type_e *type);
998 * @brief Updates notification data.
999 * @details The updated notification will appear in the notification area.
1000 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1002 * @privilege %http://tizen.org/privilege/notification
1003 * @param[in] noti The notification handle that is created by notification_create()
1004 * @return #NOTIFICATION_ERROR_NONE on success,
1005 * otherwise any other value on failure
1006 * @retval #NOTIFICATION_ERROR_NONE Success
1007 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1008 * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Priv ID does not exist
1009 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1012 #include <notification.h>
1015 int noti_err = NOTIFICATION_ERROR_NONE;
1017 noti_err = notification_update(NULL);
1018 if (noti_err != NOTIFICATION_ERROR_NONE)
1023 int notification_update(notification_h noti);
1027 * @brief Deletes a notification with the given handle.
1028 * @details notification_delete() removes notification data from database and notification_free() releases memory of notification data.
1029 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1031 * @privilege %http://tizen.org/privilege/notification
1032 * @param[in] noti The notification handle
1033 * @return #NOTIFICATION_ERROR_NONE on success,
1034 * otherwise any other value on failure
1035 * @retval #NOTIFICATION_ERROR_NONE Success
1036 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1037 * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1040 #include <notification.h>
1043 notification_h noti = NULL;
1044 int noti_err = NOTIFICATION_ERROR_NONE;
1048 noti_err = notification_delete(noti);
1049 if (noti_err != NOTIFICATION_ERROR_NONE)
1055 int notification_delete(notification_h noti);
1059 * @brief Creates internal structure data and returns a notification handle.
1060 * @details Available type is #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING.
1061 * #NOTIFICATION_TYPE_NOTI is remaining notification data even if device is restarted.
1062 * #NOTIFICATION_TYPE_ONGOING can display progress on a notification with #NOTIFICATION_LY_ONGOING_PROGRESS layout.
1063 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1064 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1065 * @param[in] type The notification type
1066 * @return Notification handle(notification_h) on success,
1067 * otherwise @c NULL on failure
1068 * @retval notification_h Success
1069 * @retval NULL Failure
1070 * @exception #NOTIFICATION_ERROR_NONE Success
1071 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1072 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1073 * @exception #NOTIFICATION_ERROR_IO_ERROR I/O error
1074 * @see #notification_type_e
1077 #include <notification.h>
1080 notification_h noti = NULL;
1082 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1091 notification_h notification_create(notification_type_e type);
1095 * @brief Creates a notification clone.
1096 * @details Newly created notification handle is returned.
1097 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1098 * @remarks This cloned notification handle should be freed using notification_free().
1099 * @param[in] noti The notification handle
1100 * @param[out] clone The newly created notification handle that has same with input @a noti
1101 * @return #NOTIFICATION_ERROR_NONE if success,
1102 * otherwise any other value if failure
1103 * @retval #NOTIFICATION_ERROR_NONE Success
1104 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1105 * @see #notification_type_e
1108 #include <notification.h>
1111 notification_h noti = notification_create(NOTIFICATION_TYPE_NOTI);
1112 notification_h clone = NULL;
1114 notification_clone(noti, &clone);
1121 int notification_clone(notification_h noti, notification_h *clone);
1125 * @brief Frees the internal structure data of a notification handle.
1126 * @details Internal data of a notification handle is released. Data of the inserted notification is not deleted.
1127 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1128 * @param[in] noti The notification handle
1129 * @return #NOTIFICATION_ERROR_NONE on success,
1130 * otherwise any other value on failure
1131 * @retval #NOTIFICATION_ERROR_NONE Success
1132 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1133 * @pre Notification handle should be created by notification_create().
1136 #include <notification.h>
1139 notification_h noti = NULL;
1140 int noti_err = NOTIFICATION_ERROR_NONE;
1142 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1148 noti_err = notification_free(noti);
1149 if (noti_err != NOTIFICATION_ERROR_NONE)
1155 int notification_free(notification_h noti);
1164 * @addtogroup NOTIFICATION_MODULE
1170 * @brief Sets the tag of the notification handle.
1171 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1172 * @param[in] noti Notification handle
1173 * @param[in] tag Tag for loading notification handle
1174 * @return #NOTIFICATION_ERROR_NONE on success,
1175 * other value on failure
1176 * @retval #NOTIFICATION_ERROR_NONE Success
1177 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1178 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1179 * @see notification_get_tag()
1182 #include <notification.h>
1185 notification_h noti = NULL;
1186 int noti_err = NOTIFICATION_ERROR_NONE;
1188 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1194 noti_err = notification_set_tag(noti, tag);
1195 if (noti_err != NOTIFICATION_ERROR_NONE)
1201 int notification_set_tag(notification_h noti, const char *tag);
1205 * @brief Gets the tag of the notification handle.
1206 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1207 * @param[in] noti Notification handle
1208 * @param[out] tag Tag for loading notification handle
1209 * @return #NOTIFICATION_ERROR_NONE on success,
1210 * other value on failure
1211 * @retval #NOTIFICATION_ERROR_NONE Success
1212 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1213 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1214 * @see notification_set_tag()
1217 #include <notification.h>
1220 int noti_err = NOTIFICATION_ERROR_NONE;
1221 const char *tag = NULL;
1225 noti_err = notification_get_tag(noti, &tag);
1226 if (noti_err != NOTIFICATION_ERROR_NONE)
1232 int notification_get_tag(notification_h noti, const char **tag);
1236 * @brief Loads a notification from the notification's database with the tag.
1237 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1239 * @privilege %http://tizen.org/privilege/notification
1240 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1241 * @param[in] tag Tag for loading notification handle
1242 * @return Notification handle(notification_h) on success,
1244 * @retval notification_h Success
1245 * @retval NULL Failure
1246 * @exception #NOTIFICATION_ERROR_NONE Success
1247 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1248 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1249 * @exception #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1250 * @see #notification_type_e
1253 #include <notification.h>
1256 notification_h noti = NULL;
1258 noti = notification_load_by_tag(tag);
1267 notification_h notification_load_by_tag(const char *tag);
1271 * @brief Deletes all notifications of the given type.
1272 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1274 * @privilege %http://tizen.org/privilege/notification
1275 * @param[in] type Notification type
1276 * @return #NOTIFICATION_ERROR_NONE if success,
1277 * other value if failure
1278 * @retval #NOTIFICATION_ERROR_NONE Success
1279 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1280 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1283 #include <notification.h>
1286 int noti_err = NOTIFICATION_ERROR_NONE;
1288 noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
1289 if (noti_err != NOTIFICATION_ERROR_NONE)
1295 int notification_delete_all(notification_type_e type);
1299 * @brief Posts a notification.
1300 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1302 * @privilege %http://tizen.org/privilege/notification
1303 * @param[in] noti Notification handle
1304 * @return #NOTIFICATION_ERROR_NONE if success,
1305 * other value if failure
1306 * @retval #NOTIFICATION_ERROR_NONE Success
1307 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1308 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1309 * @pre Notification handle should be created by notification_create().
1310 * @post notification_free().
1313 #include <notification.h>
1316 int noti_err = NOTIFICATION_ERROR_NONE;
1318 noti_err = notification_post(noti);
1319 if (noti_err != NOTIFICATION_ERROR_NONE)
1325 int notification_post(notification_h noti);
1329 * @brief Gets the package name of the notification.
1330 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1331 * @param[in] noti Notification handle
1332 * @param[out] pkgname The package name of the notification
1333 * @return #NOTIFICATION_ERROR_NONE on success,
1334 * otherwise a negative error value
1335 * @retval NOTIFICATION_ERROR_NONE Success
1336 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1339 #include <notification.h>
1342 notification_h noti = NULL;
1343 int noti_err = NOTIFICATION_ERROR_NONE;
1344 char *pkgname = NULL;
1348 noti_err = notification_get_pkgname(noti, &pkgname);
1350 if (noti_err != NOTIFICATION_ERROR_NONE) {
1351 notification_free(noti);
1357 int notification_get_pkgname(notification_h noti, char **pkgname);
1361 * @brief Adds a button on the notification.
1362 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1363 * @param[in] noti Notification handle
1364 * @param[in] button_index Button index
1365 * @return #NOTIFICATION_ERROR_NONE on success,
1366 * otherwise a negative error value
1367 * @retval NOTIFICATION_ERROR_NONE Success
1368 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1371 #include <notification.h>
1374 notification_h noti = NULL;
1375 int noti_err = NOTIFICATION_ERROR_NONE;
1376 char *pkgname = NULL;
1380 noti_err = notification_add_button(noti, NOTIFICATION_BUTTON_1);
1382 if (noti_err != NOTIFICATION_ERROR_NONE) {
1383 notification_free(noti);
1389 int notification_add_button(notification_h noti, notification_button_index_e button_index);
1392 * @brief Removes a button on the notification.
1393 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1394 * @param[in] noti Notification handle
1395 * @param[in] button_index Button index
1396 * @return #NOTIFICATION_ERROR_NONE on success,
1397 * otherwise a negative error value
1398 * @retval NOTIFICATION_ERROR_NONE Success
1399 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1402 #include <notification.h>
1405 notification_h noti = NULL;
1406 int noti_err = NOTIFICATION_ERROR_NONE;
1407 char *pkgname = NULL;
1411 noti_err = notification_remove_button(noti, NOTIFICATION_BUTTON_1);
1413 if (noti_err != NOTIFICATION_ERROR_NONE) {
1414 notification_free(noti);
1420 int notification_remove_button(notification_h noti, notification_button_index_e button_index);
1424 * @brief Sets the 'auto remove' option of the active notification.
1425 * @details The 'auto remove' option lets the active notification be removed several seconds after it shows. Default value is true.
1426 * @remarks When 'auto_remove' is set as false, the active notification will not be removed
1427 * as long as the user removes the active notification or the app which posted the active notification removes the active notification.
1428 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1429 * @param[in] noti Notification handle
1430 * @param[in] auto_remove Auto remove option
1431 * @return #NOTIFICATION_ERROR_NONE On success,
1432 * other value if failure
1433 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1434 * @see #notification_h
1435 * @see #notification_get_auto_remove
1438 #include <notification.h>
1441 notification_h noti = NULL;
1442 int noti_err = NOTIFICATION_ERROR_NONE;
1446 noti_err = notification_set_auto_remove(noti, false);
1447 if (noti_err != NOTIFICATION_ERROR_NONE)
1453 int notification_set_auto_remove(notification_h noti, bool auto_remove);
1457 * @brief Gets the 'auto remove' option of the active notification.
1458 * @details The 'auto remove' option lets the active notification be removed several seconds after it shows. Default value is true.
1459 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1460 * @param[in] noti Notification handle
1461 * @param[out] auto_remove Auto remove option
1462 * @return #NOTIFICATION_ERROR_NONE On success, other value on failure
1463 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1464 * @see #notification_h
1465 * @see #notification_get_auto_remove
1468 #include <notification.h>
1471 int noti_err = NOTIFICATION_ERROR_NONE;
1476 noti_err = notification_get_auto_remove(noti, &auto_remove);
1477 if (noti_err != NOTIFICATION_ERROR_NONE)
1483 int notification_get_auto_remove(notification_h noti, bool *auto_remove);
1487 * @brief Saves a notification template to the notification database.
1488 * @details An application can save the created notification as a template for later reuse.
1489 * If the template has the same name as a saved one, the saved template will be overwritten.
1490 * A saved template can be loaded only by the application which saved it.
1491 * All templates are removed when the application package is uninstalled.
1494 * @privilege %http://tizen.org/privilege/notification
1495 * @remarks The number of templates is limited to 10.
1496 * When you try to add more than 10 templates, #NOTIFICATION_ERROR_MAX_EXCEEDED will be returned.
1497 * @param[in] noti Notification handle
1498 * @param[in] template_name Template name
1499 * @return #NOTIFICATION_ERROR_NONE On success, other value on failure
1500 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1501 * @retval #NOTIFICATION_ERROR_IO_ERROR I/O error
1502 * @retval #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1503 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The Permission denied
1504 * @retval #NOTIFICATION_ERROR_MAX_EXCEEDED Max notification count exceeded
1505 * @see #notification_h
1506 * @see notification_create_from_template()
1509 #include <notification.h>
1512 int noti_err = NOTIFICATION_ERROR_NONE;
1513 notification_h noti = NULL;
1515 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1519 // add the content you want to use for the template.
1521 noti_err = notification_save_as_template(noti, "CALL_ACCEPT");
1522 if (noti_err != NOTIFICATION_ERROR_NONE)
1525 noti_err = notification_free(noti);
1526 if (noti_err != NOTIFICATION_ERROR_NONE)
1531 int notification_save_as_template(notification_h noti, const char *template_name);
1535 * @brief Loads a notification template from the notification database.
1536 * @details An application can load a saved template and post it.
1537 * An application can load only templates that it has saved.
1540 * @privilege %http://tizen.org/privilege/notification
1541 * @remarks The returned handle should be destroyed using notification_free().
1542 * The specific error code can be obtained using get_last_result().
1543 * Error codes are described in the Exception section.
1544 * If an invalid template name is given, the result will be set to #NOTIFICATION_ERROR_FROM_DB.
1545 * @param[in] template_name Template name
1546 * @return Notification handle on success, NULL on failure
1547 * @exception #NOTIFICATION_ERROR_NONE Success
1548 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1549 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1550 * @exception #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1551 * @exception #NOTIFICATION_ERROR_FROM_DB Error from DB query
1552 * @see #notification_h
1553 * @see notification_save_as_template()
1556 #include <notification.h>
1559 notification_h noti = NULL;
1561 noti = notification_create_from_template("CALL_ACCEPT");
1568 notification_h notification_create_from_template(const char *template_name);
1572 * @brief Gets notification block state.
1573 * @details The user can set the notification block state in settings.
1574 * The block state indicates whether or not notifications can be posted.
1575 * Additionally only notifications to the notification panel are
1576 * allowed in "Do not disturb mode". Sound, Vibrate and
1577 * Active/Instant notifications are blocked.
1580 * @privilege %http://tizen.org/privilege/notification
1581 * @param[out] state Notification block state
1582 * @return #NOTIFICATION_ERROR_NONE On success, other value on failure
1583 * @retval #NOTIFICATION_ERROR_NONE Success
1584 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1585 * @retval #NOTIFICATION_ERROR_OUT_OF_MEMORY out of memory
1586 * @retval #NOTIFICATION_ERROR_IO_ERROR I/O Error
1587 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED Permission denied
1588 * @retval #NOTIFICATION_ERROR_SERVICE_NOT_READY No response from notification service
1589 * @see #notification_block_state_e
1592 #include <notification.h>
1595 int noti_err = NOTIFICATION_ERROR_NONE;
1596 notification_block_state_e state;
1600 noti_err = notification_get_noti_block_state(&state);
1601 if (noti_err != NOTIFICATION_ERROR_NONE)
1607 int notification_get_noti_block_state(notification_block_state_e *state);
1611 * @brief Sets a text input box to reply directly on the notification.
1612 * @details When you add a text input to the active notification, the notification UI will show a text input with a button.
1613 * So, the user can enter any text and press the button to confirm the text as a input.
1614 * You can edit some UI component that is related to the text input.
1615 * First, you can add placeholder text to guide the user using notification_set_text() with #NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER type.
1616 * You also can edit button for the text input.
1617 * 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.
1618 * 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.
1620 * Note that you should set an app_control for handling the event for user input using notification_set_event_handler().
1621 * #NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON is the event type for the text input.
1622 * You can get the text the user enters in the app_control handle that is passed as a result of the event.
1623 * 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.
1624 * The value will contain the text user enters.
1626 * Note that you are able to make the switching button to the text input box.
1627 * You have to set the app_control which you will set in a text input box to the switching button.
1628 * Refer to the second sample code.
1630 * @param[in] noti Notification handle
1631 * @param[in] text_input_max_length The maximum value which can be inputted
1632 * @return #NOTIFICATION_ERROR_NONE on success,
1633 * otherwise any other value on failure
1634 * @retval #NOTIFICATION_ERROR_NONE Success
1635 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1638 #include <notification.h>
1641 int noti_err = NOTIFICATION_ERROR_NONE;
1642 notification_h noti = NULL;
1645 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1649 noti_err = notification_set_text_input(noti, 160);
1650 if (noti_err != NOTIFICATION_ERROR_NONE)
1653 noti_err = notification_set_text(noti,
1654 NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER,
1657 NOTIFICATION_VARIABLE_TYPE_NONE);
1658 if (noti_err != NOTIFICATION_ERROR_NONE)
1661 noti_err = notification_set_text(noti,
1662 NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON,
1665 NOTIFICATION_VARIABLE_TYPE_NONE);
1666 if (noti_err != NOTIFICATION_ERROR_NONE)
1669 noti_err = notification_set_display_applist(noti,
1670 NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_ACTIVE);
1671 if (noti_err != NOTIFICATION_ERROR_NONE)
1676 noti_err = app_control_create(&app_control);
1677 if (noti_err != APP_CONTROL_ERROR_NONE)
1680 noti_err = app_control_set_app_id(app_control, appid);
1681 if (noti_err != APP_CONTROL_ERROR_NONE)
1684 noti_err = app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
1685 if (noti_err != APP_CONTROL_ERROR_NONE)
1688 noti_err = notification_set_event_handler(noti,
1689 NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON,
1691 if (noti_err != NOTIFICATION_ERROR_NONE)
1694 noti_err = app_control_destroy(app_control);
1695 if (noti_err != APP_CONTROL_ERROR_NONE)
1698 noti_err = notification_post(noti);
1699 if(noti_err != NOTIFICATION_ERROR_NONE)
1706 int noti_err = NOTIFICATION_ERROR_NONE;
1707 notification_h noti = NULL;
1710 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1715 noti_err = notification_set_text_input(noti, 160);
1716 if (noti_err != NOTIFICATION_ERROR_NONE)
1719 noti_err = notification_set_text(noti,
1720 NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER,
1723 NOTIFICATION_VARIABLE_TYPE_NONE);
1724 if (noti_err != NOTIFICATION_ERROR_NONE)
1727 noti_err = notification_set_text(noti,
1728 NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON,
1731 NOTIFICATION_VARIABLE_TYPE_NONE);
1732 if (noti_err != NOTIFICATION_ERROR_NONE)
1735 noti_err = notification_add_button(notification, NOTIFICATION_BUTTON_1);
1736 if (noti_err != NOTIFICATION_ERROR_NONE)
1739 noti_err = notification_set_text(notification,
1740 NOTIFICATION_TEXT_TYPE_BUTTON_1,
1743 NOTIFICATION_VARIABLE_TYPE_NONE);
1744 if (noti_err != NOTIFICATION_ERROR_NONE)
1747 noti_err = notification_set_display_applist(noti,
1748 NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_ACTIVE);
1749 if (noti_err != NOTIFICATION_ERROR_NONE)
1754 noti_err = app_control_create(&app_control);
1755 if (noti_err != APP_CONTROL_ERROR_NONE)
1758 noti_err = app_control_set_app_id(app_control, appid);
1759 if (noti_err != APP_CONTROL_ERROR_NONE)
1762 noti_err = app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
1763 if (noti_err != APP_CONTROL_ERROR_NONE)
1766 noti_err = notification_set_event_handler(notification,
1767 NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1,
1769 if (noti_err != NOTIFICATION_ERROR_NONE)
1772 noti_err = notification_set_event_handler(noti,
1773 NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON,
1775 if (noti_err != NOTIFICATION_ERROR_NONE)
1778 noti_err = app_control_destroy(app_control);
1779 if (noti_err != APP_CONTROL_ERROR_NONE)
1782 noti_err = notification_post(noti);
1783 if(noti_err != NOTIFICATION_ERROR_NONE)
1788 int notification_set_text_input(notification_h noti, int text_input_max_length);
1792 * @brief Sets the image height for the extended notification.
1793 * @details The image is shown under the notification's text. The application can set the image height.
1794 * The image is modified to fit into the height set by this function.
1795 * The image can be scaled down and/or cropped.
1796 * If @a height is 0, the default value is used. The default height depends on the screen size.
1798 * @param[in] noti The notification handle
1799 * @param[in] height The image height
1800 * @return #NOTIFICATION_ERROR_NONE On success,
1801 * otherwise a negative error value
1802 * @retval #NOTIFICATION_ERROR_NONE Success
1803 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1804 * @see notification_get_extension_image_size()
1807 #include <notification.h>
1810 notification_h noti = NULL;
1811 int noti_err = NOTIFICATION_ERROR_NONE;
1813 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1817 noti_err = notification_set_text(noti,
1818 NOTIFICATION_TEXT_TYPE_CONTENT_EXTENTION,
1821 NOTIFICATION_VARIABLE_TYPE_NONE);
1822 if (noti_err != NOTIFICATION_ERROR_NONE)
1825 noti_err = notification_set_image(noti,
1826 NOTIFICATION_IMAGE_TYPE_EXTENTION,
1828 if (noti_err != NOTIFICATION_ERROR_NONE)
1831 noti_err = notification_set_layout(noti, NOTIFICATION_LY_EXTENTION);
1832 if (noti_err != NOTIFICATION_ERROR_NONE)
1835 noti_err = notification_set_extension_image_size(noti, 20);
1836 if (noti_err != NOTIFICATION_ERROR_NONE)
1843 int notification_set_extension_image_size(notification_h noti, int height);
1847 * @brief Gets the image height for the extended notification.
1849 * @param[in] noti The notification handle
1850 * @param[out] height The image height
1851 * @return #NOTIFICATION_ERROR_NONE On success, otherwise a negative error value
1852 * @retval #NOTIFICATION_ERROR_NONE Success
1853 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1854 * @see notification_set_extension_image_size()
1857 #include <notification.h>
1860 int noti_err = NOTIFICATION_ERROR_NONE;
1865 noti_err = notification_get_extension_image_size(noti, &height);
1866 if (noti_err != NOTIFICATION_ERROR_NONE)
1871 int notification_get_extension_image_size(notification_h noti, int *height);
1880 #endif /* __NOTIFICATION_H__ */