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.
17 #ifndef __NOTIFICATION_H__
18 #define __NOTIFICATION_H__
22 #include <app_control.h>
24 #include <notification_error.h>
25 #include <notification_type.h>
26 #include <notification_status.h>
34 * @file notification.h
35 * @brief This file contains the notification API.
40 * @addtogroup NOTIFICATION_MODULE
46 * @brief Sets an absolute path for an image file to display on the notification view.
47 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
48 * @param[in] noti The notification handle
49 * @param[in] type The notification image type
50 * @param[in] image_path The image file full path
51 * @return #NOTIFICATION_ERROR_NONE on success,
52 * otherwise any other value on failure
53 * @retval #NOTIFICATION_ERROR_NONE Success
54 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
55 * @pre Notification handle should be created by notification_create().
56 * @see #notification_image_type_e
57 * @see notification_create()
60 #include <notification.h>
63 notification_h noti = NULL;
64 int noti_err = NOTIFICATION_ERROR_NONE;
66 noti = notification_create(NOTIFICATION_TYPE_NOTI);
70 noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, APP_IMAGE_FULL_PATH);
71 if (noti_err != NOTIFICATION_ERROR_NONE) {
72 notification_free(noti);
78 int notification_set_image(notification_h noti, notification_image_type_e type, const char *image_path);
82 * @brief Gets the absolute path of an image file.
83 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
84 * @remarks Do not free @a image_path. It will be freed when notification_free() is called.
85 * @param[in] noti Notification handle
86 * @param[in] type Notification image type
87 * @param[out] image_path Image file full path
88 * @return NOTIFICATION_ERROR_NONE on success,
89 * other value on failure
90 * @retval NOTIFICATION_ERROR_NONE Success
91 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
92 * @pre Notification handle should be created by notification_create().
93 * @see #notification_image_type_e
94 * @see notification_create()
97 #include <notification.h>
100 char *image_path = NULL;
101 int noti_err = NOTIFICATION_ERROR_NONE;
103 noti_err = notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, &image_path);
104 if (noti_err != NOTIFICATION_ERROR_NONE)
109 int notification_get_image(notification_h noti, notification_image_type_e type, char **image_path);
113 * @brief Sets a timestamp.
114 * @details If input_time is @c 0, time information is taken from the current time.
115 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
116 * @param[in] noti The notification handle
117 * @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
118 * @return #NOTIFICATION_ERROR_NONE on success,
119 * otherwise any other value on failure
120 * @retval #NOTIFICATION_ERROR_NONE Success
121 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
122 * @pre Notification handle should be created by notification_create().
123 * @see notification_create()
124 * @see NOTIFICATION_DO_NOT_SHOW_TIME_STAMP
127 #include <notification.h>
130 notification_h noti = NULL;
131 int noti_err = NOTIFICATION_ERROR_NONE;
133 noti = notification_create(NOTIFICATION_TYPE_NOTI);
137 noti_err = notification_set_time(noti, time(NULL));
138 if (noti_err != NOTIFICATION_ERROR_NONE) {
139 notification_free(noti);
145 int notification_set_time(notification_h noti, time_t input_time);
149 * @brief Gets a timestamp.
150 * @details If ret_time is @c 0, time information is not set before.
151 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
152 * @param[in] noti The notification handle
153 * @param[out] ret_time The return time value
154 * @return #NOTIFICATION_ERROR_NONE on success,
155 * otherwise any other value on failure
156 * @retval #NOTIFICATION_ERROR_NONE Success
157 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
158 * @pre Notification handle should be created by notification_create().
159 * @see notification_create()
162 #include <notification.h>
166 int noti_err = NOTIFICATION_ERROR_NONE;
168 noti_err = notification_get_time(noti, &ret_time);
169 if (noti_err != NOTIFICATION_ERROR_NONE)
174 int notification_get_time(notification_h noti, time_t *ret_time);
178 * @brief Gets an insertion timestamp of the notification.
179 * @details If ret_time is @c 0, this notification data is not inserted before.
180 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
181 * @param[in] noti The notification handle
182 * @param[out] ret_time The return time value
183 * @return #NOTIFICATION_ERROR_NONE on success,
184 * otherwise any other value on failure
185 * @retval #NOTIFICATION_ERROR_NONE Success
186 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
189 #include <notification.h>
193 int noti_err = NOTIFICATION_ERROR_NONE;
195 noti_err = notification_get_insert_time(noti, &ret_time);
196 if (noti_err != NOTIFICATION_ERROR_NONE)
201 int notification_get_insert_time(notification_h noti, time_t *ret_time);
205 * @brief Sets the text to display on the notification view.
206 * @details Sets title, content string. If the text is formatted data (only %d, %f, %s are supported), type - value pair should be set.
207 * If %d, the type #NOTIFICATION_VARIABLE_TYPE_INT and the value is an integer.
208 * If %f, the type #NOTIFICATION_VARIABLE_TYPE_DOUBLE and the value is a double.
209 * If %s, the type #NOTIFICATION_VARIABLE_TYPE_STRING and the value is a string.
210 * If the type is #NOTIFICATION_VARIABLE_TYPE_COUNT, notification count is displaying with text.
211 * If the value is #NOTIFICATION_COUNT_POS_LEFT, count is displayed at the left of the text.
212 * If the value is #NOTIFICATION_COUNT_POS_IN, count is displayed in the text when text has %d format.
213 * If the value is #NOTIFICATION_COUNT_POS_RIGHT, count is displayed at the right of the text.
214 * Variable parameters should be terminated #NOTIFICATION_VARIABLE_TYPE_NONE.
216 * Note that You can display the translated contents according to the language of the system.
217 * The application must supply a String KEY as the fourth argument to support localization.
218 * If the language on the system changes, the contents of the notification are also translated.
220 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
221 * @param[in] noti The notification handle
222 * @param[in] type The notification text type
223 * @param[in] text The basic text
224 * @param[in] key The text key for localization
225 * @param[in] args_type The variable parameter that type - value pair
226 * @return #NOTIFICATION_ERROR_NONE on success,
227 * otherwise any other value on failure
228 * @retval #NOTIFICATION_ERROR_NONE Success
229 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
230 * @pre notification handle should be created by notification_create().
233 #include <notification.h>
236 notification_h noti = NULL;
237 int noti_err = NOTIFICATION_ERROR_NONE;
239 noti = notification_create(NOTIFICATION_TYPE_NOTI);
243 noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
244 "I'm Title", "IDS_APP_BODY_IM_TITLE", NOTIFICATION_VARIABLE_TYPE_NONE);
245 if (noti_err != NOTIFICATION_ERROR_NONE) {
246 notification_free(noti);
252 int notification_set_text(notification_h noti, notification_text_type_e type,
253 const char *text, const char *key, int args_type, ...);
257 * @brief Gets the text from the notification handle.
258 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
259 * @param[in] noti The notification handle
260 * @param[in] type The notification text type
261 * @param[out] text The notification text
262 * @return #NOTIFICATION_ERROR_NONE on success,
263 * otherwise any other value on failure
264 * @retval #NOTIFICATION_ERROR_NONE Success
265 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
268 #include <notification.h>
271 notification_h noti = NULL;
272 int noti_err = NOTIFICATION_ERROR_NONE;
275 noti_err = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, &text);
276 if (noti_err != NOTIFICATION_ERROR_NONE)
282 int notification_get_text(notification_h noti, notification_text_type_e type, char **text);
286 * @brief Sets the timestamp to display on the notification view.
287 * @details The timestamp will be converted to a formatted string and it will be displayed on the set text area.
288 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
289 * @param[in] noti The notification handle
290 * @param[in] type The notification text type
291 * @param[in] time The timestamp
292 * @return #NOTIFICATION_ERROR_NONE on success,
293 * otherwise any other value on failure
294 * @retval #NOTIFICATION_ERROR_NONE Success
295 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
296 * @pre Notification handle should be created by notification_create().
298 int notification_set_time_to_text(notification_h noti, notification_text_type_e type, time_t time);
302 * @brief Gets the timestamp from the notification handle.
303 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
304 * @param[in] noti The notification handle
305 * @param[in] type The notification text type
306 * @param[in] time The pointer of time stamp
307 * @return #NOTIFICATION_ERROR_NONE on success,
308 * otherwise any other value on failure
309 * @retval #NOTIFICATION_ERROR_NONE Success
310 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
311 * @pre Notification handle should be created by notification_create().
313 int notification_get_time_from_text(notification_h noti, notification_text_type_e type, time_t *time);
317 * @brief Sets the sound type for the notification.
318 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
319 * @param[in] noti The notification handle
320 * @param[in] type The notification sound type
321 * @param[in] path The user sound file path
322 * @return #NOTIFICATION_ERROR_NONE on success,
323 * otherwise any other value on failure
324 * @retval #NOTIFICATION_ERROR_NONE Success
325 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
328 #include <notification.h>
331 notification_h noti = NULL;
332 int noti_err = NOTIFICATION_ERROR_NONE;
334 noti_err = notification_set_sound(noti, NOTIFICATION_SOUND_TYPE_DEFAULT, NULL);
335 if (noti_err != NOTIFICATION_ERROR_NONE)
341 int notification_set_sound(notification_h noti, notification_sound_type_e type, const char *path);
345 * @brief Gets the sound type from the notification handle.
346 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
347 * @param[in] noti The notification handle
348 * @param[out] type The notification sound type
349 * @param[out] path The user sound file path
350 * @return #NOTIFICATION_ERROR_NONE on success,
351 * otherwise any other value on failure
352 * @retval #NOTIFICATION_ERROR_NONE Success
353 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
356 #include <notification.h>
359 notification_h noti = NULL;
360 int noti_err = NOTIFICATION_ERROR_NONE;
361 notification_sound_type_e type = NOTIFICATION_SOUND_TYPE_NONE;
363 noti_err = notification_get_sound(noti, &type, NULL);
364 if (noti_err != NOTIFICATION_ERROR_NONE)
370 int notification_get_sound(notification_h noti, notification_sound_type_e *type, const char **path);
374 * @brief Sets the vibration type for the notification.
375 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
376 * @param[in] noti The notification handle
377 * @param[in] type The notification vibration type
378 * @param[in] path The user vibration file path
379 * @return #NOTIFICATION_ERROR_NONE on success,
380 * otherwise any other value on failure
381 * @retval #NOTIFICATION_ERROR_NONE Success
382 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
385 #include <notification.h>
388 notification_h noti = NULL;
389 int noti_err = NOTIFICATION_ERROR_NONE;
391 noti_err = notification_set_vibration(noti, NOTIFICATION_VIBRATION_TYPE_DEFAULT, NULL);
392 if (noti_err != NOTIFICATION_ERROR_NONE)
398 int notification_set_vibration(notification_h noti, notification_vibration_type_e type, const char *path);
402 * @brief Gets the vibrate type from the notification handle.
403 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
404 * @param[in] noti The notification handle
405 * @param[out] type The notification sound type
406 * @param[out] path The user vibration file path
407 * @return #NOTIFICATION_ERROR_NONE on success,
408 * otherwise other value on failure
409 * @retval #NOTIFICATION_ERROR_NONE Success
410 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
413 #include <notification.h>
416 notification_h noti = NULL;
417 int noti_err = NOTIFICATION_ERROR_NONE;
418 notification_vibration_type_e type = NOTIFICATION_VIBRATION_TYPE_NONE;
420 noti_err = notification_get_vibration(noti, &type, NULL);
421 if (noti_err != NOTIFICATION_ERROR_NONE)
427 int notification_get_vibration(notification_h noti, notification_vibration_type_e *type, const char **path);
431 * @brief Sets the LED displaying option.
432 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
433 * @param[in] noti The notification handle
434 * @param[in] operation The LED notification operation
435 * @param[in] led_argb The notification LED color
436 * @return #NOTIFICATION_ERROR_NONE on success,
437 * otherwise other value on failure
438 * @retval #NOTIFICATION_ERROR_NONE Success
439 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
442 #include <notification.h>
445 notification_h noti = NULL;
446 int noti_err = NOTIFICATION_ERROR_NONE;
448 noti_err = notification_set_led(noti, NOTIFICATION_LED_OP_ON, NULL);
449 if (noti_err != NOTIFICATION_ERROR_NONE)
455 int notification_set_led(notification_h noti, notification_led_op_e operation, int led_argb);
459 * @brief Gets the LED displaying option from the notification handle.
460 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
461 * @param[in] noti The notification handle
462 * @param[out] operation The LED notification operation
463 * @param[out] led_argb The notification LED color
464 * @return #NOTIFICATION_ERROR_NONE on success,
465 * otherwise any other value on failure
466 * @retval #NOTIFICATION_ERROR_NONE Success
467 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
470 #include <notification.h>
473 notification_h noti = NULL;
474 int noti_err = NOTIFICATION_ERROR_NONE;
475 notification_led_type_e type = NOTIFICATION_LED_OP_OFF;
477 noti_err = notification_get_led(noti, &type, NULL);
478 if (noti_err != NOTIFICATION_ERROR_NONE)
484 int notification_get_led(notification_h noti, notification_led_op_e *operation, int *led_argb);
488 * @brief Sets the time period of flashing the LED.
489 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
490 * @param[in] noti The notification handle
491 * @param[in] on_ms The time for turning on the LED
492 * @param[in] off_ms The time for turning off the LED
493 * @return #NOTIFICATION_ERROR_NONE on success,
494 * otherwise any other value on failure
495 * @retval #NOTIFICATION_ERROR_NONE Success
496 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
499 #include <notification.h>
502 notification_h noti = NULL;
503 int noti_err = NOTIFICATION_ERROR_NONE;
505 noti_err = notification_set_led_time_period(noti, 100, 100);
506 if (noti_err != NOTIFICATION_ERROR_NONE)
512 int notification_set_led_time_period(notification_h noti, int on_ms, int off_ms);
516 * @brief Gets the time period of flashing the LED from the notification handle.
517 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
518 * @param[in] noti The notification handle
519 * @param[out] on_ms The time for turning on the LED
520 * @param[out] off_ms The time for turning on the LED
521 * @return #NOTIFICATION_ERROR_NONE on success,
522 * otherwise any other value on failure
523 * @retval #NOTIFICATION_ERROR_NONE Success
524 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
527 #include <notification.h>
530 notification_h noti = NULL;
531 int noti_err = NOTIFICATION_ERROR_NONE;
535 noti_err = notification_get_led_time_period(noti, &led_on_ms, &led_off_ms);
536 if (noti_err != NOTIFICATION_ERROR_NONE)
542 int notification_get_led_time_period(notification_h noti, int *on_ms, int *off_ms);
546 * @brief Sets the launch option for a notification.
547 * @details When notification data selected in display application, application launched by app_control_send_launch_request with app_control handle.
548 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
549 * @param[in] noti The notification handle
550 * @param[in] type Launching option type
551 * @param[in] option App Control handler
552 * @return #NOTIFICATION_ERROR_NONE on success,
553 * otherwise any other value on failure
554 * @retval #NOTIFICATION_ERROR_NONE Success
555 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
558 #include <notification.h>
561 notification_h noti = NULL;
562 app_control_h app_control = NULL;
563 int noti_err = NOTIFICATION_ERROR_NONE;
567 app_control_create(&app_control);
568 app_control_set_app_id(app_control, "org.tizen.app");
572 noti_err = notification_set_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)app_control);
573 if (noti_err != NOTIFICATION_ERROR_NONE) {
574 app_control_destroy(app_control);
575 notification_free(noti);
579 app_control_destroy(app_control);
583 int notification_set_launch_option(notification_h noti, notification_launch_option_type type, void *option);
587 * @brief Gets the launch option from the notification handle.
588 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
589 * @remarks You must release @a app_control using app_control_destroy().
590 * @param[in] noti The notification handle
591 * @param[in] type Launching option type
592 * @param[out] option The pointer of App Control handler
593 * @return #NOTIFICATION_ERROR_NONE on success,
594 * otherwise any other value on failure
595 * @retval #NOTIFICATION_ERROR_NONE Success
596 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
599 #include <notification.h>
602 app_control_h app_control = NULL;
603 app_control_create(&app_control);
607 noti_err = notification_get_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)&app_control);
608 if (noti_err != NOTIFICATION_ERROR_NONE)
613 int notification_get_launch_option(notification_h noti, notification_launch_option_type type, void *option);
617 * @brief Sets the handler for a specific event.
618 * @details When some event occurs on notification, application launched by app_control_send_launch_request with app_control handle. \n
619 * Setting event handler of a button means that the notification will show the button.
620 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
621 * @param[in] noti The notification handle
622 * @param[in] event_type Event type
623 * @param[in] event_handler App control handle
624 * @return #NOTIFICATION_ERROR_NONE on success,
625 * otherwise any other value on failure
626 * @retval #NOTIFICATION_ERROR_NONE Success
627 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
628 * @see #notification_event_type_e
631 #include <notification.h>
634 notification_h noti = NULL;
635 app_control_h app_control = NULL;
636 int noti_err = NOTIFICATION_ERROR_NONE;
640 app_control_create(&app_control);
641 app_control_set_app_id(app_control, "org.tizen.app");
645 noti_err = notification_set_event_handler(noti, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, app_control);
646 if (noti_err != NOTIFICATION_ERROR_NONE) {
647 app_control_destroy(app_control);
648 notification_free(noti);
652 app_control_destroy(app_control);
656 int notification_set_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h event_handler);
660 * @brief Gets the event handler of a specific event.
661 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
662 * @remarks You must release @a app_control using app_control_destroy().
663 * @param[in] noti The notification handle
664 * @param[in] event_type Launching option type
665 * @param[out] event_handler The handler of App Control
666 * @return #NOTIFICATION_ERROR_NONE on success,
667 * otherwise any other value on failure
668 * @retval #NOTIFICATION_ERROR_NONE Success
669 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
670 * @see #notification_event_type_e
673 #include <notification.h>
676 app_control_h app_control = NULL;
677 app_control_create(&app_control);
681 noti_err = notification_get_event_handler(noti, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, &app_control);
682 if (noti_err != NOTIFICATION_ERROR_NONE) {
683 notification_free(noti);
689 int notification_get_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h *event_handler);
693 * @brief Sets the property of the notification.
694 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
695 * @param[in] noti The notification handle
696 * @param[in] flags The property with | operation
697 * @return #NOTIFICATION_ERROR_NONE on success,
698 * otherwise any other value on failure
699 * @retval #NOTIFICATION_ERROR_NONE Success
700 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
703 #include <notification.h>
706 notification_h noti = NULL;
707 int noti_err = NOTIFICATION_ERROR_NONE;
710 noti = notification_create(NOTIFICATION_TYPE_NOTI);
714 noti_err = notification_set_property(noti, NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE | NOTIFICATION_PROP_DISABLE_APP_LAUNCH);
715 if (noti_err != NOTIFICATION_ERROR_NONE) {
716 notification_free(noti);
722 int notification_set_property(notification_h noti, int flags);
726 * @brief Gets the property of the notification from the notification handle.
727 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
728 * @param[in] noti The notification handle
729 * @param[out] flags The notification property
730 * @return #NOTIFICATION_ERROR_NONE on success,
731 * otherwise any other value on failure
732 * @retval #NOTIFICATION_ERROR_NONE Success
733 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
736 #include <notification.h>
739 notification_h noti = NULL;
740 int noti_err = NOTIFICATION_ERROR_NONE;
743 noti_err = notification_get_property(noti, &flags);
744 if (noti_err != NOTIFICATION_ERROR_NONE)
750 int notification_get_property(notification_h noti, int *flags);
754 * @brief Sets applications to display the notification.
755 * @details All display application is enabled(NOTIFICATION_DISPLAY_APP_ALL) if you do not call this API.
756 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
757 * @param[in] noti The notification handle
758 * @param[in] applist The with | operation
759 * @return #NOTIFICATION_ERROR_NONE on success,
760 * otherwise any other value on failure
761 * @retval #NOTIFICATION_ERROR_NONE Success
762 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
765 #include <notification.h>
768 notification_h noti = NULL;
769 int noti_err = NOTIFICATION_ERROR_NONE;
772 noti = notification_create(NOTIFICATION_TYPE_NOTI);
776 noti_err = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY |
777 NOTIFICATION_DISPLAY_APP_TICKER | NOTIFICATION_DISPLAY_APP_INDICATOR);
778 if (noti_err != NOTIFICATION_ERROR_NONE) {
779 notification_free(noti);
785 int notification_set_display_applist(notification_h noti, int applist);
789 * @brief Gets the application list displaying the notification from the notification handle.
790 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
791 * @param[in] noti The notification handle
792 * @param[out] applist The display application list
793 * @return #NOTIFICATION_ERROR_NONE on success,
794 * otherwise any other value on failure
795 * @retval #NOTIFICATION_ERROR_NONE Success
796 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
799 #include <notification.h>
802 notification_h noti = NULL;
803 int noti_err = NOTIFICATION_ERROR_NONE;
806 noti_err = notification_get_display_applist(noti, &applist);
807 if (noti_err != NOTIFICATION_ERROR_NONE)
813 int notification_get_display_applist(notification_h noti, int *applist);
817 * @brief Sets the initial size for the ongoing type.
818 * @details After notification_post() call, the size is not updated.
819 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
820 * @param[in] noti The notification handle
821 * @param[in] size The double type size
822 * @return #NOTIFICATION_ERROR_NONE on success,
823 * otherwise any other value on failure
824 * @retval #NOTIFICATION_ERROR_NONE Success
825 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
828 #include <notification.h>
831 notification_h noti = NULL;
832 int noti_err = NOTIFICATION_ERROR_NONE;
834 noti = notification_create(NOTIFICATION_TYPE_NOTI);
838 noti_err = notification_set_size(noti, 0.0);
839 if (noti_err != NOTIFICATION_ERROR_NONE) {
840 notification_free(noti);
846 int notification_set_size(notification_h noti, double size);
850 * @brief Gets the progress size.
851 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
852 * @param[in] noti The notification handle
853 * @param[out] size The progress size
854 * @return #NOTIFICATION_ERROR_NONE on success,
855 * otherwise any other value on failure
856 * @retval #NOTIFICATION_ERROR_NONE Success
857 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
860 #include <notification.h>
863 notification_h noti = NULL;
864 int noti_err = NOTIFICATION_ERROR_NONE;
867 noti_err = notification_get_size(noti, &size);
868 if (noti_err != NOTIFICATION_ERROR_NONE)
873 int notification_get_size(notification_h noti, double *size);
877 * @brief Sets the initial progress for the ongoing type.
878 * @details After the notification_post() call, the progress is not updated.
879 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
880 * @param[in] noti The notification handle
881 * @param[in] percentage The progress percentage
882 * @return #NOTIFICATION_ERROR_NONE on success,
883 * otherwise any other value on failure
884 * @retval #NOTIFICATION_ERROR_NONE Success
885 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
888 #include <notification.h>
891 notification_h noti = NULL;
892 int noti_err = NOTIFICATION_ERROR_NONE;
894 noti = notification_create(NOTIFICATION_TYPE_NOTI);
898 noti_err = notification_set_progress(noti, 0.0);
899 if (noti_err != NOTIFICATION_ERROR_NONE) {
900 notification_free(noti);
906 int notification_set_progress(notification_h noti, double percentage);
910 * @brief Gets the progress from the notification handle.
911 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
912 * @remarks At the end of the operation, the progress should be @c 1.0.
913 * @param[in] noti The notification handle
914 * @param[out] percentage The progress percentage
915 * @return #NOTIFICATION_ERROR_NONE on success,
916 * otherwise any other value on failure
917 * @retval #NOTIFICATION_ERROR_NONE Success
918 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
921 #include <notification.h>
924 notification_h noti = NULL;
925 int noti_err = NOTIFICATION_ERROR_NONE;
926 double percentage = 0.0;
928 noti_err = notification_get_progress(noti, &percentage);
929 if (noti_err != NOTIFICATION_ERROR_NONE)
935 int notification_get_progress(notification_h noti, double *percentage);
939 * @brief Sets the layout of the notification view.
940 * @details Caller can set displaying layout of notification.
941 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
942 * @param[in] noti The notification handle
943 * @param[in] layout The type of layout
944 * @return #NOTIFICATION_ERROR_NONE on success,
945 * otherwise any other value on failure
946 * @retval #NOTIFICATION_ERROR_NONE Success
947 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
948 * @see #notification_ly_type_e
950 int notification_set_layout(notification_h noti, notification_ly_type_e layout);
954 * @brief Gets the layout of the notification view from the notification handle.
955 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
956 * @param[in] noti The notification handle
957 * @param[out] layout The type of layout
958 * @return #NOTIFICATION_ERROR_NONE on success,
959 * otherwise any other value on failure
960 * @retval #NOTIFICATION_ERROR_NONE Success
961 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
962 * @see #notification_ly_type_e
964 int notification_get_layout(notification_h noti, notification_ly_type_e *layout);
968 * @brief Gets the type of a notification.
969 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
970 * @param[in] noti The notification handle
971 * @param[out] type The notification type
972 * @return #NOTIFICATION_ERROR_NONE on success,
973 * otherwise any other value on failure
974 * @retval #NOTIFICATION_ERROR_NONE Success
975 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
978 #include <notification.h>
981 int noti_err = NOTIFICATION_ERROR_NONE;
982 notification_type_e type;
984 noti_err = notification_get_type(noti, &type);
985 if (noti_err != NOTIFICATION_ERROR_NONE)
990 int notification_get_type(notification_h noti, notification_type_e *type);
994 * @brief Updates notification data.
995 * @details The updated notification will appear in the notification area.
996 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
998 * @privilege %http://tizen.org/privilege/notification
999 * @param[in] noti The notification handle that is created by notification_create()
1000 * @return #NOTIFICATION_ERROR_NONE on success,
1001 * otherwise any other value on failure
1002 * @retval #NOTIFICATION_ERROR_NONE Success
1003 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1004 * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Priv ID does not exist
1005 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1008 #include <notification.h>
1011 int noti_err = NOTIFICATION_ERROR_NONE;
1013 noti_err = notification_update(NULL);
1014 if (noti_err != NOTIFICATION_ERROR_NONE)
1019 int notification_update(notification_h noti);
1023 * @brief Deletes a notification with the given handle.
1024 * @details notification_delete() removes notification data from database and notification_free() releases memory of notification data.
1025 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1027 * @privilege %http://tizen.org/privilege/notification
1028 * @param[in] noti The notification handle
1029 * @return #NOTIFICATION_ERROR_NONE on success,
1030 * otherwise any other value on failure
1031 * @retval #NOTIFICATION_ERROR_NONE Success
1032 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1033 * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1036 #include <notification.h>
1039 notification_h noti = NULL;
1040 int noti_err = NOTIFICATION_ERROR_NONE;
1044 noti_err = notification_delete(noti);
1045 if (noti_err != NOTIFICATION_ERROR_NONE)
1051 int notification_delete(notification_h noti);
1055 * @brief Creates internal structure data and returns a notification handle.
1056 * @details Available type is #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING.
1057 * #NOTIFICATION_TYPE_NOTI is remaining notification data even if device is restarted.
1058 * #NOTIFICATION_TYPE_ONGOING can display progress on a notification with #NOTIFICATION_LY_ONGOING_PROGRESS layout.
1059 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1060 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1061 * @param[in] type The notification type
1062 * @return Notification handle(notification_h) on success,
1063 * otherwise @c NULL on failure
1064 * @retval notification_h Success
1065 * @retval NULL Failure
1066 * @exception #NOTIFICATION_ERROR_NONE Success
1067 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1068 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1069 * @exception #NOTIFICATION_ERROR_IO_ERROR I/O error
1070 * @see #notification_type_e
1073 #include <notification.h>
1076 notification_h noti = NULL;
1078 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1087 notification_h notification_create(notification_type_e type);
1091 * @brief Creates a notification clone.
1092 * @details Newly created notification handle is returned.
1093 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1094 * @remarks This cloned notification handle should be freed using notification_free().
1095 * @param[in] noti The notification handle
1096 * @param[out] clone The newly created notification handle that has same with input @a noti
1097 * @return #NOTIFICATION_ERROR_NONE if success,
1098 * otherwise any other value if failure
1099 * @retval #NOTIFICATION_ERROR_NONE Success
1100 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1101 * @see #notification_type_e
1104 #include <notification.h>
1107 notification_h noti = notification_create(NOTIFICATION_TYPE_NOTI);
1108 notification_h clone = NULL;
1110 notification_clone(noti, &clone);
1117 int notification_clone(notification_h noti, notification_h *clone);
1121 * @brief Frees the internal structure data of a notification handle.
1122 * @details Internal data of a notification handle is released. Data of the inserted notification is not deleted.
1123 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1124 * @param[in] noti The notification handle
1125 * @return #NOTIFICATION_ERROR_NONE on success,
1126 * otherwise any other value on failure
1127 * @retval #NOTIFICATION_ERROR_NONE Success
1128 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1129 * @pre Notification handle should be created by notification_create().
1132 #include <notification.h>
1135 notification_h noti = NULL;
1136 int noti_err = NOTIFICATION_ERROR_NONE;
1138 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1144 noti_err = notification_free(noti);
1145 if (noti_err != NOTIFICATION_ERROR_NONE)
1151 int notification_free(notification_h noti);
1155 * @brief Sets the tag of the notification handle.
1156 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1157 * @param[in] noti Notification handle
1158 * @param[in] tag Tag for loading notification handle
1159 * @return #NOTIFICATION_ERROR_NONE on success,
1160 * other value on failure
1161 * @retval #NOTIFICATION_ERROR_NONE Success
1162 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1163 * @see notification_get_tag()
1166 #include <notification.h>
1169 notification_h noti = NULL;
1170 int noti_err = NOTIFICATION_ERROR_NONE;
1172 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1178 noti_err = notification_set_tag(noti, tag);
1179 if (noti_err != NOTIFICATION_ERROR_NONE)
1185 int notification_set_tag(notification_h noti, const char *tag);
1189 * @brief Gets the tag of the notification handle.
1190 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1191 * @param[in] noti Notification handle
1192 * @param[out] tag Tag for loading notification handle
1193 * @return #NOTIFICATION_ERROR_NONE on success,
1194 * other value on failure
1195 * @retval #NOTIFICATION_ERROR_NONE Success
1196 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1197 * @see notification_set_tag()
1200 #include <notification.h>
1203 int noti_err = NOTIFICATION_ERROR_NONE;
1204 const char *tag = NULL;
1208 noti_err = notification_get_tag(noti, &tag);
1209 if (noti_err != NOTIFICATION_ERROR_NONE)
1215 int notification_get_tag(notification_h noti, const char **tag);
1219 * @brief Loads a notification from the notification's database with the tag.
1220 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1222 * @privilege %http://tizen.org/privilege/notification
1223 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1224 * @param[in] tag Tag for loading notification handle
1225 * @return Notification handle(notification_h) on success,
1227 * @retval notification_h Success
1228 * @retval NULL Failure
1229 * @exception #NOTIFICATION_ERROR_NONE Success
1230 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1231 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1232 * @exception #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1233 * @see #notification_type_e
1236 #include <notification.h>
1239 notification_h noti = NULL;
1241 noti = notification_load_by_tag(tag);
1250 notification_h notification_load_by_tag(const char *tag);
1254 * @brief Deletes all notifications of the given type.
1255 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1257 * @privilege %http://tizen.org/privilege/notification
1258 * @param[in] type Notification type
1259 * @return #NOTIFICATION_ERROR_NONE if success,
1260 * other value if failure
1261 * @retval #NOTIFICATION_ERROR_NONE Success
1262 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1263 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1266 #include <notification.h>
1269 int noti_err = NOTIFICATION_ERROR_NONE;
1271 noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
1272 if (noti_err != NOTIFICATION_ERROR_NONE)
1278 int notification_delete_all(notification_type_e type);
1282 * @brief Posts a notification.
1283 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1285 * @privilege %http://tizen.org/privilege/notification
1286 * @param[in] noti Notification handle
1287 * @return #NOTIFICATION_ERROR_NONE if success,
1288 * other value if failure
1289 * @retval #NOTIFICATION_ERROR_NONE Success
1290 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1291 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1292 * @pre Notification handle should be created by notification_create().
1293 * @post notification_free().
1296 #include <notification.h>
1299 int noti_err = NOTIFICATION_ERROR_NONE;
1301 noti_err = notification_post(noti);
1302 if (noti_err != NOTIFICATION_ERROR_NONE)
1308 int notification_post(notification_h noti);
1312 * @brief Gets the package name of the notification.
1313 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1314 * @param[in] noti Notification handle
1315 * @param[out] pkgname The package name of the notification
1316 * @return #NOTIFICATION_ERROR_NONE on success,
1317 * otherwise a negative error value
1318 * @retval NOTIFICATION_ERROR_NONE Success
1319 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1322 #include <notification.h>
1325 notification_h noti = NULL;
1326 int noti_err = NOTIFICATION_ERROR_NONE;
1327 char *pkgname = NULL;
1331 noti_err = notification_get_pkgname(noti, &pkgname);
1333 if (noti_err != NOTIFICATION_ERROR_NONE) {
1334 notification_free(noti);
1340 int notification_get_pkgname(notification_h noti, char **pkgname);
1344 * @brief Adds a button on the notification.
1345 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1346 * @param[in] noti Notification handle
1347 * @param[in] button_index Button index
1348 * @return #NOTIFICATION_ERROR_NONE on success,
1349 * otherwise a negative error value
1350 * @retval NOTIFICATION_ERROR_NONE Success
1351 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1354 #include <notification.h>
1357 notification_h noti = NULL;
1358 int noti_err = NOTIFICATION_ERROR_NONE;
1359 char *pkgname = NULL;
1363 noti_err = notification_add_button(noti, NOTIFICATION_BUTTON_1);
1365 if (noti_err != NOTIFICATION_ERROR_NONE) {
1366 notification_free(noti);
1372 int notification_add_button(notification_h noti, notification_button_index_e button_index);
1376 * @brief Removes a button on the notification.
1377 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1378 * @param[in] noti Notification handle
1379 * @param[in] button_index Button index
1380 * @return #NOTIFICATION_ERROR_NONE on success,
1381 * otherwise a negative error value
1382 * @retval NOTIFICATION_ERROR_NONE Success
1383 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1386 #include <notification.h>
1389 notification_h noti = NULL;
1390 int noti_err = NOTIFICATION_ERROR_NONE;
1391 char *pkgname = NULL;
1395 noti_err = notification_remove_button(noti, NOTIFICATION_BUTTON_1);
1397 if (noti_err != NOTIFICATION_ERROR_NONE) {
1398 notification_free(noti);
1404 int notification_remove_button(notification_h noti, notification_button_index_e button_index);
1408 * @brief Sets the 'auto remove' option of the active notification.
1409 * @details The 'auto remove' option lets the active notification be removed several seconds after it shows. Default value is true.
1410 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1411 * @remarks When 'auto_remove' is set as false, the active notification will not be removed
1412 * as long as the user removes the active notification or the app which posted the active notification removes the active notification.
1413 * @param[in] noti Notification handle
1414 * @param[in] auto_remove Auto remove option
1415 * @return #NOTIFICATION_ERROR_NONE On success,
1416 * other value if failure
1417 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1418 * @see #notification_h
1419 * @see #notification_get_auto_remove
1422 #include <notification.h>
1425 notification_h noti = NULL;
1426 int noti_err = NOTIFICATION_ERROR_NONE;
1430 noti_err = notification_set_auto_remove(noti, false);
1431 if (noti_err != NOTIFICATION_ERROR_NONE)
1437 int notification_set_auto_remove(notification_h noti, bool auto_remove);
1441 * @brief Gets the 'auto remove' option of the active notification.
1442 * @details The 'auto remove' option lets the active notification be removed several seconds after it shows. Default value is true.
1443 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1444 * @param[in] noti Notification handle
1445 * @param[out] auto_remove Auto remove option
1446 * @return #NOTIFICATION_ERROR_NONE On success, other value on failure
1447 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1448 * @see #notification_h
1449 * @see #notification_get_auto_remove
1452 #include <notification.h>
1455 int noti_err = NOTIFICATION_ERROR_NONE;
1460 noti_err = notification_get_auto_remove(noti, &auto_remove);
1461 if (noti_err != NOTIFICATION_ERROR_NONE)
1467 int notification_get_auto_remove(notification_h noti, bool *auto_remove);
1471 * @brief Saves a notification template to the notification database.
1472 * @details An application can save the created notification as a template for later reuse.
1473 * If the template has the same name as a saved one, the saved template will be overwritten.
1474 * A saved template can be loaded only by the application which saved it.
1475 * All templates are removed when the application package is uninstalled.
1478 * @privilege %http://tizen.org/privilege/notification
1479 * @remarks The number of templates is limited to 10.
1480 * When you try to add more than 10 templates, #NOTIFICATION_ERROR_MAX_EXCEEDED will be returned.
1481 * @param[in] noti Notification handle
1482 * @param[in] template_name Template name
1483 * @return #NOTIFICATION_ERROR_NONE On success, other value on failure
1484 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1485 * @retval #NOTIFICATION_ERROR_IO_ERROR I/O error
1486 * @retval #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1487 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The Permission denied
1488 * @retval #NOTIFICATION_ERROR_MAX_EXCEEDED Max notification count exceeded
1489 * @see #notification_h
1490 * @see notification_create_from_template()
1493 #include <notification.h>
1496 int noti_err = NOTIFICATION_ERROR_NONE;
1497 notification_h noti = NULL;
1499 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1503 // add the content you want to use for the template.
1505 noti_err = notification_save_as_template(noti, "CALL_ACCEPT");
1506 if (noti_err != NOTIFICATION_ERROR_NONE)
1509 noti_err = notification_free(noti);
1510 if (noti_err != NOTIFICATION_ERROR_NONE)
1515 int notification_save_as_template(notification_h noti, const char *template_name);
1519 * @brief Loads a notification template from the notification database.
1520 * @details An application can load a saved template and post it.
1521 * An application can load only templates that it has saved.
1524 * @privilege %http://tizen.org/privilege/notification
1525 * @remarks The returned handle should be destroyed using notification_free().
1526 * The specific error code can be obtained using get_last_result().
1527 * Error codes are described in the Exception section.
1528 * If an invalid template name is given, the result will be set to #NOTIFICATION_ERROR_FROM_DB.
1529 * @param[in] template_name Template name
1530 * @return Notification handle on success, NULL on failure
1531 * @exception #NOTIFICATION_ERROR_NONE Success
1532 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1533 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1534 * @exception #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1535 * @exception #NOTIFICATION_ERROR_FROM_DB Error from DB query
1536 * @see #notification_h
1537 * @see notification_save_as_template()
1540 #include <notification.h>
1543 notification_h noti = NULL;
1545 noti = notification_create_from_template("CALL_ACCEPT");
1552 notification_h notification_create_from_template(const char *template_name);
1556 * @brief Gets notification block state.
1557 * @details The user can set the notification block state in settings.
1558 * The block state indicates whether or not notifications can be posted.
1559 * Additionally only notifications to the notification panel are
1560 * allowed in "Do not disturb mode". Sound, Vibrate and
1561 * Active/Instant notifications are blocked.
1564 * @privilege %http://tizen.org/privilege/notification
1565 * @param[out] state Notification block state
1566 * @return #NOTIFICATION_ERROR_NONE On success, other value on failure
1567 * @retval #NOTIFICATION_ERROR_NONE Success
1568 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1569 * @retval #NOTIFICATION_ERROR_OUT_OF_MEMORY out of memory
1570 * @retval #NOTIFICATION_ERROR_IO_ERROR I/O Error
1571 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED Permission denied
1572 * @retval #NOTIFICATION_ERROR_SERVICE_NOT_READY No response from notification service
1573 * @see #notification_block_state_e
1576 #include <notification.h>
1579 int noti_err = NOTIFICATION_ERROR_NONE;
1580 notification_block_state_e state;
1584 noti_err = notification_get_noti_block_state(&state);
1585 if (noti_err != NOTIFICATION_ERROR_NONE)
1591 int notification_get_noti_block_state(notification_block_state_e *state);
1595 * @brief Sets a text input box to reply directly on the notification.
1596 * @details When you add a text input to the active notification, the notification UI will show a text input with a button.
1597 * So, the user can enter any text and press the button to confirm the text as a input.
1598 * You can edit some UI component that is related to the text input.
1599 * First, you can add placeholder text to guide the user using notification_set_text() with #NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER type.
1600 * You also can edit button for the text input.
1601 * 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.
1602 * 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.
1604 * Note that you should set an app_control for handling the event for user input using notification_set_event_handler().
1605 * #NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON is the event type for the text input.
1606 * You can get the text the user enters in the app_control handle that is passed as a result of the event.
1607 * 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.
1608 * The value will contain the text user enters.
1610 * Note that you are able to make the switching button to the text input box.
1611 * You have to set the app_control which you will set in a text input box to the switching button.
1612 * Refer to the second sample code.
1614 * @param[in] noti Notification handle
1615 * @param[in] text_input_max_length The maximum value which can be inputted
1616 * @return #NOTIFICATION_ERROR_NONE on success,
1617 * otherwise any other value on failure
1618 * @retval #NOTIFICATION_ERROR_NONE Success
1619 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1622 #include <notification.h>
1625 int noti_err = NOTIFICATION_ERROR_NONE;
1626 notification_h noti = NULL;
1629 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1633 noti_err = notification_set_text_input(noti, 160);
1634 if (noti_err != NOTIFICATION_ERROR_NONE)
1637 noti_err = notification_set_text(noti,
1638 NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER,
1641 NOTIFICATION_VARIABLE_TYPE_NONE);
1642 if (noti_err != NOTIFICATION_ERROR_NONE)
1645 noti_err = notification_set_text(noti,
1646 NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON,
1649 NOTIFICATION_VARIABLE_TYPE_NONE);
1650 if (noti_err != NOTIFICATION_ERROR_NONE)
1653 noti_err = notification_set_display_applist(noti,
1654 NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_ACTIVE);
1655 if (noti_err != NOTIFICATION_ERROR_NONE)
1660 noti_err = app_control_create(&app_control);
1661 if (noti_err != APP_CONTROL_ERROR_NONE)
1664 noti_err = app_control_set_app_id(app_control, appid);
1665 if (noti_err != APP_CONTROL_ERROR_NONE)
1668 noti_err = app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
1669 if (noti_err != APP_CONTROL_ERROR_NONE)
1672 noti_err = notification_set_event_handler(noti,
1673 NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON,
1675 if (noti_err != NOTIFICATION_ERROR_NONE)
1678 noti_err = app_control_destroy(app_control);
1679 if (noti_err != APP_CONTROL_ERROR_NONE)
1682 noti_err = notification_post(noti);
1683 if(noti_err != NOTIFICATION_ERROR_NONE)
1690 int noti_err = NOTIFICATION_ERROR_NONE;
1691 notification_h noti = NULL;
1694 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1699 noti_err = notification_set_text_input(noti, 160);
1700 if (noti_err != NOTIFICATION_ERROR_NONE)
1703 noti_err = notification_set_text(noti,
1704 NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER,
1707 NOTIFICATION_VARIABLE_TYPE_NONE);
1708 if (noti_err != NOTIFICATION_ERROR_NONE)
1711 noti_err = notification_set_text(noti,
1712 NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON,
1715 NOTIFICATION_VARIABLE_TYPE_NONE);
1716 if (noti_err != NOTIFICATION_ERROR_NONE)
1719 noti_err = notification_add_button(notification, NOTIFICATION_BUTTON_1);
1720 if (noti_err != NOTIFICATION_ERROR_NONE)
1723 noti_err = notification_set_text(notification,
1724 NOTIFICATION_TEXT_TYPE_BUTTON_1,
1727 NOTIFICATION_VARIABLE_TYPE_NONE);
1728 if (noti_err != NOTIFICATION_ERROR_NONE)
1731 noti_err = notification_set_display_applist(noti,
1732 NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_ACTIVE);
1733 if (noti_err != NOTIFICATION_ERROR_NONE)
1738 noti_err = app_control_create(&app_control);
1739 if (noti_err != APP_CONTROL_ERROR_NONE)
1742 noti_err = app_control_set_app_id(app_control, appid);
1743 if (noti_err != APP_CONTROL_ERROR_NONE)
1746 noti_err = app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
1747 if (noti_err != APP_CONTROL_ERROR_NONE)
1750 noti_err = notification_set_event_handler(notification,
1751 NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1,
1753 if (noti_err != NOTIFICATION_ERROR_NONE)
1756 noti_err = notification_set_event_handler(noti,
1757 NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON,
1759 if (noti_err != NOTIFICATION_ERROR_NONE)
1762 noti_err = app_control_destroy(app_control);
1763 if (noti_err != APP_CONTROL_ERROR_NONE)
1766 noti_err = notification_post(noti);
1767 if(noti_err != NOTIFICATION_ERROR_NONE)
1772 int notification_set_text_input(notification_h noti, int text_input_max_length);
1776 * @brief Sets the image height for the extended notification.
1777 * @details The image is shown under the notification's text. The application can set the image height.
1778 * The image is modified to fit into the height set by this function.
1779 * The image can be scaled down and/or cropped.
1780 * If @a height is 0, the default value is used. The default height depends on the screen size.
1782 * @param[in] noti The notification handle
1783 * @param[in] height The image height
1784 * @return #NOTIFICATION_ERROR_NONE On success,
1785 * otherwise a negative error value
1786 * @retval #NOTIFICATION_ERROR_NONE Success
1787 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1788 * @see notification_get_extension_image_size()
1791 #include <notification.h>
1794 notification_h noti = NULL;
1795 int noti_err = NOTIFICATION_ERROR_NONE;
1797 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1801 noti_err = notification_set_text(noti,
1802 NOTIFICATION_TEXT_TYPE_CONTENT_EXTENTION,
1805 NOTIFICATION_VARIABLE_TYPE_NONE);
1806 if (noti_err != NOTIFICATION_ERROR_NONE)
1809 noti_err = notification_set_image(noti,
1810 NOTIFICATION_IMAGE_TYPE_EXTENTION,
1812 if (noti_err != NOTIFICATION_ERROR_NONE)
1815 noti_err = notification_set_layout(noti, NOTIFICATION_LY_EXTENTION);
1816 if (noti_err != NOTIFICATION_ERROR_NONE)
1819 noti_err = notification_set_extension_image_size(noti, 20);
1820 if (noti_err != NOTIFICATION_ERROR_NONE)
1827 int notification_set_extension_image_size(notification_h noti, int height);
1831 * @brief Gets the image height for the extended notification.
1833 * @param[in] noti The notification handle
1834 * @param[out] height The image height
1835 * @return #NOTIFICATION_ERROR_NONE On success, otherwise a negative error value
1836 * @retval #NOTIFICATION_ERROR_NONE Success
1837 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1838 * @see notification_set_extension_image_size()
1841 #include <notification.h>
1844 int noti_err = NOTIFICATION_ERROR_NONE;
1849 noti_err = notification_get_extension_image_size(noti, &height);
1850 if (noti_err != NOTIFICATION_ERROR_NONE)
1855 int notification_get_extension_image_size(notification_h noti, int *height);
1864 #endif /* __NOTIFICATION_H__ */