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 * @see #notification_type_e
1076 #include <notification.h>
1079 notification_h noti = NULL;
1081 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1090 notification_h notification_create(notification_type_e type);
1094 * @brief Creates a notification clone.
1095 * @details Newly created notification handle is returned.
1096 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1097 * @remarks This cloned notification handle should be freed using notification_free().
1098 * @param[in] noti The notification handle
1099 * @param[out] clone The newly created notification handle that has same with input @a noti
1100 * @return #NOTIFICATION_ERROR_NONE if success,
1101 * otherwise any other value if failure
1102 * @retval #NOTIFICATION_ERROR_NONE Success
1103 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1104 * @see #notification_type_e
1107 #include <notification.h>
1110 notification_h noti = notification_create(NOTIFICATION_TYPE_NOTI);
1111 notification_h clone = NULL;
1113 notification_clone(noti, &clone);
1120 int notification_clone(notification_h noti, notification_h *clone);
1124 * @brief Frees the internal structure data of a notification handle.
1125 * @details Internal data of a notification handle is released. Data of the inserted notification is not deleted.
1126 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1127 * @param[in] noti The notification handle
1128 * @return #NOTIFICATION_ERROR_NONE on success,
1129 * otherwise any other value on failure
1130 * @retval #NOTIFICATION_ERROR_NONE Success
1131 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1132 * @pre Notification handle should be created by notification_create().
1135 #include <notification.h>
1138 notification_h noti = NULL;
1139 int noti_err = NOTIFICATION_ERROR_NONE;
1141 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1147 noti_err = notification_free(noti);
1148 if (noti_err != NOTIFICATION_ERROR_NONE)
1154 int notification_free(notification_h noti);
1163 * @addtogroup NOTIFICATION_MODULE
1169 * @brief Sets the tag of the notification handle.
1170 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1171 * @param[in] noti Notification handle
1172 * @param[in] tag Tag for loading notification handle
1173 * @return #NOTIFICATION_ERROR_NONE on success,
1174 * other value on failure
1175 * @retval #NOTIFICATION_ERROR_NONE Success
1176 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1177 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1178 * @see notification_get_tag()
1181 #include <notification.h>
1184 notification_h noti = NULL;
1185 int noti_err = NOTIFICATION_ERROR_NONE;
1187 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1193 noti_err = notification_set_tag(noti, tag);
1194 if (noti_err != NOTIFICATION_ERROR_NONE)
1200 int notification_set_tag(notification_h noti, const char *tag);
1204 * @brief Gets the tag of the notification handle.
1205 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1206 * @param[in] noti Notification handle
1207 * @param[out] tag Tag for loading notification handle
1208 * @return #NOTIFICATION_ERROR_NONE on success,
1209 * other value on failure
1210 * @retval #NOTIFICATION_ERROR_NONE Success
1211 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1212 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1213 * @see notification_set_tag()
1216 #include <notification.h>
1219 int noti_err = NOTIFICATION_ERROR_NONE;
1220 const char *tag = NULL;
1224 noti_err = notification_get_tag(noti, &tag);
1225 if (noti_err != NOTIFICATION_ERROR_NONE)
1231 int notification_get_tag(notification_h noti, const char **tag);
1235 * @brief Loads a notification from the notification's database with the tag.
1236 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1238 * @privilege %http://tizen.org/privilege/notification
1239 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1240 * @param[in] tag Tag for loading notification handle
1241 * @return Notification handle(notification_h) on success,
1243 * @retval notification_h Success
1244 * @retval NULL Failure
1245 * @exception #NOTIFICATION_ERROR_NONE Success
1246 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1247 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1248 * @exception #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1249 * @see #notification_type_e
1252 #include <notification.h>
1255 notification_h noti = NULL;
1257 noti = notification_load_by_tag(tag);
1266 notification_h notification_load_by_tag(const char *tag);
1270 * @brief Deletes all notifications of the given type.
1271 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1273 * @privilege %http://tizen.org/privilege/notification
1274 * @param[in] type Notification type
1275 * @return #NOTIFICATION_ERROR_NONE if success,
1276 * other value if failure
1277 * @retval #NOTIFICATION_ERROR_NONE Success
1278 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1279 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1282 #include <notification.h>
1285 int noti_err = NOTIFICATION_ERROR_NONE;
1287 noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
1288 if (noti_err != NOTIFICATION_ERROR_NONE)
1294 int notification_delete_all(notification_type_e type);
1298 * @brief Posts a notification.
1299 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1301 * @privilege %http://tizen.org/privilege/notification
1302 * @param[in] noti Notification handle
1303 * @return #NOTIFICATION_ERROR_NONE if success,
1304 * other value if failure
1305 * @retval #NOTIFICATION_ERROR_NONE Success
1306 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1307 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1308 * @pre Notification handle should be created by notification_create().
1309 * @post notification_free().
1312 #include <notification.h>
1315 int noti_err = NOTIFICATION_ERROR_NONE;
1317 noti_err = notification_post(noti);
1318 if (noti_err != NOTIFICATION_ERROR_NONE)
1324 int notification_post(notification_h noti);
1328 * @brief Gets the package name of the notification.
1329 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1330 * @param[in] noti Notification handle
1331 * @param[out] pkgname The package name of the notification
1332 * @return #NOTIFICATION_ERROR_NONE on success,
1333 * otherwise a negative error value
1334 * @retval NOTIFICATION_ERROR_NONE Success
1335 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1338 #include <notification.h>
1341 notification_h noti = NULL;
1342 int noti_err = NOTIFICATION_ERROR_NONE;
1343 char *pkgname = NULL;
1347 noti_err = notification_get_pkgname(noti, &pkgname);
1349 if (noti_err != NOTIFICATION_ERROR_NONE) {
1350 notification_free(noti);
1356 int notification_get_pkgname(notification_h noti, char **pkgname);
1360 * @brief Adds a button on the notification.
1361 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1362 * @param[in] noti Notification handle
1363 * @param[in] button_index Button index
1364 * @return #NOTIFICATION_ERROR_NONE on success,
1365 * otherwise a negative error value
1366 * @retval NOTIFICATION_ERROR_NONE Success
1367 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1370 #include <notification.h>
1373 notification_h noti = NULL;
1374 int noti_err = NOTIFICATION_ERROR_NONE;
1375 char *pkgname = NULL;
1379 noti_err = notification_add_button(noti, NOTIFICATION_BUTTON_1);
1381 if (noti_err != NOTIFICATION_ERROR_NONE) {
1382 notification_free(noti);
1388 int notification_add_button(notification_h noti, notification_button_index_e button_index);
1391 * @brief Removes a button on the notification.
1392 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1393 * @param[in] noti Notification handle
1394 * @param[in] button_index Button index
1395 * @return #NOTIFICATION_ERROR_NONE on success,
1396 * otherwise a negative error value
1397 * @retval NOTIFICATION_ERROR_NONE Success
1398 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1401 #include <notification.h>
1404 notification_h noti = NULL;
1405 int noti_err = NOTIFICATION_ERROR_NONE;
1406 char *pkgname = NULL;
1410 noti_err = notification_remove_button(noti, NOTIFICATION_BUTTON_1);
1412 if (noti_err != NOTIFICATION_ERROR_NONE) {
1413 notification_free(noti);
1419 int notification_remove_button(notification_h noti, notification_button_index_e button_index);
1423 * @brief Sets the 'auto remove' option of the active notification.
1424 * @details The 'auto remove' option lets the active notification be removed several seconds after it shows. Default value is true.
1425 * @remarks When 'auto_remove' is set as false, the active notification will not be removed
1426 * as long as the user removes the active notification or the app which posted the active notification removes the active notification.
1427 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1428 * @param[in] noti Notification handle
1429 * @param[in] auto_remove Auto remove option
1430 * @return #NOTIFICATION_ERROR_NONE On success,
1431 * other value if failure
1432 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1433 * @see #notification_h
1434 * @see #notification_get_auto_remove
1437 #include <notification.h>
1440 notification_h noti = NULL;
1441 int noti_err = NOTIFICATION_ERROR_NONE;
1445 noti_err = notification_set_auto_remove(noti, false);
1446 if (noti_err != NOTIFICATION_ERROR_NONE)
1452 int notification_set_auto_remove(notification_h noti, bool auto_remove);
1456 * @brief Gets the 'auto remove' option of the active notification.
1457 * @details The 'auto remove' option lets the active notification be removed several seconds after it shows. Default value is true.
1458 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1459 * @param[in] noti Notification handle
1460 * @param[out] auto_remove Auto remove option
1461 * @return #NOTIFICATION_ERROR_NONE On success, other value on failure
1462 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1463 * @see #notification_h
1464 * @see #notification_get_auto_remove
1467 #include <notification.h>
1470 int noti_err = NOTIFICATION_ERROR_NONE;
1475 noti_err = notification_get_auto_remove(noti, &auto_remove);
1476 if (noti_err != NOTIFICATION_ERROR_NONE)
1482 int notification_get_auto_remove(notification_h noti, bool *auto_remove);
1486 * @brief Saves a notification template to the notification database.
1487 * @details An application can save the created notification as a template for later reuse.
1488 * If the template has the same name as a saved one, the saved template will be overwritten.
1489 * A saved template can be loaded only by the application which saved it.
1490 * All templates are removed when the application package is uninstalled.
1493 * @privilege %http://tizen.org/privilege/notification
1494 * @remarks The number of templates is limited to 10.
1495 * When you try to add more than 10 templates, #NOTIFICATION_ERROR_MAX_EXCEEDED will be returned.
1496 * @param[in] noti Notification handle
1497 * @param[in] template_name Template name
1498 * @return #NOTIFICATION_ERROR_NONE On success, other value on failure
1499 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1500 * @retval #NOTIFICATION_ERROR_IO_ERROR I/O error
1501 * @retval #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1502 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The Permission denied
1503 * @retval #NOTIFICATION_ERROR_MAX_EXCEEDED Max notification count exceeded
1504 * @see #notification_h
1505 * @see notification_create_from_template()
1508 #include <notification.h>
1511 int noti_err = NOTIFICATION_ERROR_NONE;
1512 notification_h noti = NULL;
1514 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1518 // add the content you want to use for the template.
1520 noti_err = notification_save_as_template(noti, "CALL_ACCEPT");
1521 if (noti_err != NOTIFICATION_ERROR_NONE)
1524 noti_err = notification_free(noti);
1525 if (noti_err != NOTIFICATION_ERROR_NONE)
1530 int notification_save_as_template(notification_h noti, const char *template_name);
1534 * @brief Loads a notification template from the notification database.
1535 * @details An application can load a saved template and post it.
1536 * An application can load only templates that it has saved.
1539 * @privilege %http://tizen.org/privilege/notification
1540 * @remarks The returned handle should be destroyed using notification_free().
1541 * The specific error code can be obtained using get_last_result().
1542 * Error codes are described in the Exception section.
1543 * If an invalid template name is given, the result will be set to #NOTIFICATION_ERROR_FROM_DB.
1544 * @param[in] template_name Template name
1545 * @return Notification handle on success, NULL on failure
1546 * @exception #NOTIFICATION_ERROR_NONE Success
1547 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1548 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1549 * @exception #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1550 * @exception #NOTIFICATION_ERROR_FROM_DB Error from DB query
1551 * @see #notification_h
1552 * @see notification_save_as_template()
1555 #include <notification.h>
1558 notification_h noti = NULL;
1560 noti = notification_create_from_template("CALL_ACCEPT");
1567 notification_h notification_create_from_template(const char *template_name);
1571 * @brief Gets notification block state.
1572 * @details The user can set the notification block state in settings.
1573 * The block state indicates whether or not notifications can be posted.
1574 * Additionally only notifications to the notification panel are
1575 * allowed in "Do not disturb mode". Sound, Vibrate and
1576 * Active/Instant notifications are blocked.
1579 * @privilege %http://tizen.org/privilege/notification
1580 * @param[out] state Notification block state
1581 * @return #NOTIFICATION_ERROR_NONE On success, other value on failure
1582 * @retval #NOTIFICATION_ERROR_NONE Success
1583 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1584 * @retval #NOTIFICATION_ERROR_OUT_OF_MEMORY out of memory
1585 * @retval #NOTIFICATION_ERROR_IO_ERROR I/O Error
1586 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED Permission denied
1587 * @retval #NOTIFICATION_ERROR_SERVICE_NOT_READY No response from notification service
1588 * @see #notification_block_state_e
1591 #include <notification.h>
1594 int noti_err = NOTIFICATION_ERROR_NONE;
1595 notification_block_state_e state;
1599 noti_err = notification_get_noti_block_state(&state);
1600 if (noti_err != NOTIFICATION_ERROR_NONE)
1606 int notification_get_noti_block_state(notification_block_state_e *state);
1610 * @brief Sets a text input box to reply directly on the notification.
1611 * @details When you add a text input to the active notification, the notification UI will show a text input with a button.
1612 * So, the user can enter any text and press the button to confirm the text as a input.
1613 * You can edit some UI component that is related to the text input.
1614 * First, you can add placeholder text to guide the user using notification_set_text() with #NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER type.
1615 * You also can edit button for the text input.
1616 * 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.
1617 * 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.
1619 * Note that you should set an app_control for handling the event for user input using notification_set_event_handler().
1620 * #NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON is the event type for the text input.
1621 * You can get the text the user enters in the app_control handle that is passed as a result of the event.
1622 * 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.
1623 * The value will contain the text user enters.
1625 * Note that you are able to make the switching button to the text input box.
1626 * You have to set the app_control which you will set in a text input box to the switching button.
1627 * Refer to the second sample code.
1629 * @param[in] noti Notification handle
1630 * @param[in] text_input_max_length The maximum value which can be inputted
1631 * @return #NOTIFICATION_ERROR_NONE on success,
1632 * otherwise any other value on failure
1633 * @retval #NOTIFICATION_ERROR_NONE Success
1634 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1637 #include <notification.h>
1640 int noti_err = NOTIFICATION_ERROR_NONE;
1641 notification_h noti = NULL;
1644 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1648 noti_err = notification_set_text_input(noti, 160);
1649 if (noti_err != NOTIFICATION_ERROR_NONE)
1652 noti_err = notification_set_text(noti,
1653 NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER,
1656 NOTIFICATION_VARIABLE_TYPE_NONE);
1657 if (noti_err != NOTIFICATION_ERROR_NONE)
1660 noti_err = notification_set_text(noti,
1661 NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON,
1664 NOTIFICATION_VARIABLE_TYPE_NONE);
1665 if (noti_err != NOTIFICATION_ERROR_NONE)
1668 noti_err = notification_set_display_applist(noti,
1669 NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_ACTIVE);
1670 if (noti_err != NOTIFICATION_ERROR_NONE)
1675 noti_err = app_control_create(&app_control);
1676 if (noti_err != APP_CONTROL_ERROR_NONE)
1679 noti_err = app_control_set_app_id(app_control, appid);
1680 if (noti_err != APP_CONTROL_ERROR_NONE)
1683 noti_err = app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
1684 if (noti_err != APP_CONTROL_ERROR_NONE)
1687 noti_err = notification_set_event_handler(noti,
1688 NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON,
1690 if (noti_err != NOTIFICATION_ERROR_NONE)
1693 noti_err = app_control_destroy(app_control);
1694 if (noti_err != APP_CONTROL_ERROR_NONE)
1697 noti_err = notification_post(noti);
1698 if(noti_err != NOTIFICATION_ERROR_NONE)
1705 int noti_err = NOTIFICATION_ERROR_NONE;
1706 notification_h noti = NULL;
1709 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1714 noti_err = notification_set_text_input(noti, 160);
1715 if (noti_err != NOTIFICATION_ERROR_NONE)
1718 noti_err = notification_set_text(noti,
1719 NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER,
1722 NOTIFICATION_VARIABLE_TYPE_NONE);
1723 if (noti_err != NOTIFICATION_ERROR_NONE)
1726 noti_err = notification_set_text(noti,
1727 NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON,
1730 NOTIFICATION_VARIABLE_TYPE_NONE);
1731 if (noti_err != NOTIFICATION_ERROR_NONE)
1734 noti_err = notification_add_button(notification, NOTIFICATION_BUTTON_1);
1735 if (noti_err != NOTIFICATION_ERROR_NONE)
1738 noti_err = notification_set_text(notification,
1739 NOTIFICATION_TEXT_TYPE_BUTTON_1,
1742 NOTIFICATION_VARIABLE_TYPE_NONE);
1743 if (noti_err != NOTIFICATION_ERROR_NONE)
1746 noti_err = notification_set_display_applist(noti,
1747 NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_ACTIVE);
1748 if (noti_err != NOTIFICATION_ERROR_NONE)
1753 noti_err = app_control_create(&app_control);
1754 if (noti_err != APP_CONTROL_ERROR_NONE)
1757 noti_err = app_control_set_app_id(app_control, appid);
1758 if (noti_err != APP_CONTROL_ERROR_NONE)
1761 noti_err = app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
1762 if (noti_err != APP_CONTROL_ERROR_NONE)
1765 noti_err = notification_set_event_handler(notification,
1766 NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1,
1768 if (noti_err != NOTIFICATION_ERROR_NONE)
1771 noti_err = notification_set_event_handler(noti,
1772 NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON,
1774 if (noti_err != NOTIFICATION_ERROR_NONE)
1777 noti_err = app_control_destroy(app_control);
1778 if (noti_err != APP_CONTROL_ERROR_NONE)
1781 noti_err = notification_post(noti);
1782 if(noti_err != NOTIFICATION_ERROR_NONE)
1787 int notification_set_text_input(notification_h noti, int text_input_max_length);
1791 * @brief Sets the image height for the extended notification.
1792 * @details The image is shown under the notification's text. The application can set the image height.
1793 * The image is modified to fit into the height set by this function.
1794 * The image can be scaled down and/or cropped.
1795 * If @a height is 0, the default value is used. The default height depends on the screen size.
1797 * @param[in] noti The notification handle
1798 * @param[in] height The image height
1799 * @return #NOTIFICATION_ERROR_NONE On success,
1800 * otherwise a negative error value
1801 * @retval #NOTIFICATION_ERROR_NONE Success
1802 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1803 * @see notification_get_extension_image_size()
1806 #include <notification.h>
1809 notification_h noti = NULL;
1810 int noti_err = NOTIFICATION_ERROR_NONE;
1812 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1816 noti_err = notification_set_text(noti,
1817 NOTIFICATION_TEXT_TYPE_CONTENT_EXTENTION,
1820 NOTIFICATION_VARIABLE_TYPE_NONE);
1821 if (noti_err != NOTIFICATION_ERROR_NONE)
1824 noti_err = notification_set_image(noti,
1825 NOTIFICATION_IMAGE_TYPE_EXTENTION,
1827 if (noti_err != NOTIFICATION_ERROR_NONE)
1830 noti_err = notification_set_layout(noti, NOTIFICATION_LY_EXTENTION);
1831 if (noti_err != NOTIFICATION_ERROR_NONE)
1834 noti_err = notification_set_extension_image_size(noti, 20);
1835 if (noti_err != NOTIFICATION_ERROR_NONE)
1842 int notification_set_extension_image_size(notification_h noti, int height);
1846 * @brief Gets the image height for the extended notification.
1848 * @param[in] noti The notification handle
1849 * @param[out] height The image height
1850 * @return #NOTIFICATION_ERROR_NONE On success, otherwise a negative error value
1851 * @retval #NOTIFICATION_ERROR_NONE Success
1852 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1853 * @see notification_set_extension_image_size()
1856 #include <notification.h>
1859 int noti_err = NOTIFICATION_ERROR_NONE;
1864 noti_err = notification_get_extension_image_size(noti, &height);
1865 if (noti_err != NOTIFICATION_ERROR_NONE)
1870 int notification_get_extension_image_size(notification_h noti, int *height);
1879 #endif /* __NOTIFICATION_H__ */