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 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
666 * @remarks You must release @a app_control using app_control_destroy().
667 * @param[in] noti The notification handle
668 * @param[in] event_type Launching option type
669 * @param[out] event_handler The handler of App Control
670 * @return #NOTIFICATION_ERROR_NONE on success,
671 * otherwise any other value on failure
672 * @retval #NOTIFICATION_ERROR_NONE Success
673 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
674 * @see #notification_event_type_e
677 #include <notification.h>
680 app_control_h app_control = NULL;
681 app_control_create(&app_control);
685 noti_err = notification_get_event_handler(noti, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, &app_control);
686 if (noti_err != NOTIFICATION_ERROR_NONE) {
687 notification_free(noti);
693 int notification_get_event_handler(notification_h noti, notification_event_type_e event_type, app_control_h *event_handler);
697 * @brief Sets the property of the notification.
698 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
699 * @param[in] noti The notification handle
700 * @param[in] flags The property with | operation
701 * @return #NOTIFICATION_ERROR_NONE on success,
702 * otherwise any other value on failure
703 * @retval #NOTIFICATION_ERROR_NONE Success
704 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
707 #include <notification.h>
710 notification_h noti = NULL;
711 int noti_err = NOTIFICATION_ERROR_NONE;
714 noti = notification_create(NOTIFICATION_TYPE_NOTI);
718 noti_err = notification_set_property(noti, NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE | NOTIFICATION_PROP_DISABLE_APP_LAUNCH);
719 if (noti_err != NOTIFICATION_ERROR_NONE) {
720 notification_free(noti);
726 int notification_set_property(notification_h noti, int flags);
730 * @brief Gets the property of the notification from the notification handle.
731 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
732 * @param[in] noti The notification handle
733 * @param[out] flags The notification property
734 * @return #NOTIFICATION_ERROR_NONE on success,
735 * otherwise any other value on failure
736 * @retval #NOTIFICATION_ERROR_NONE Success
737 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
740 #include <notification.h>
743 notification_h noti = NULL;
744 int noti_err = NOTIFICATION_ERROR_NONE;
747 noti_err = notification_get_property(noti, &flags);
748 if (noti_err != NOTIFICATION_ERROR_NONE)
754 int notification_get_property(notification_h noti, int *flags);
758 * @brief Sets applications to display the notification.
759 * @details All display application is enabled(NOTIFICATION_DISPLAY_APP_ALL) if you do not call this API.
760 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
761 * @param[in] noti The notification handle
762 * @param[in] applist The with | operation
763 * @return #NOTIFICATION_ERROR_NONE on success,
764 * otherwise any other value on failure
765 * @retval #NOTIFICATION_ERROR_NONE Success
766 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
769 #include <notification.h>
772 notification_h noti = NULL;
773 int noti_err = NOTIFICATION_ERROR_NONE;
776 noti = notification_create(NOTIFICATION_TYPE_NOTI);
780 noti_err = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY |
781 NOTIFICATION_DISPLAY_APP_TICKER | NOTIFICATION_DISPLAY_APP_INDICATOR);
782 if (noti_err != NOTIFICATION_ERROR_NONE) {
783 notification_free(noti);
789 int notification_set_display_applist(notification_h noti, int applist);
793 * @brief Gets the application list displaying the notification from the notification handle.
794 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
795 * @param[in] noti The notification handle
796 * @param[out] applist The display application list
797 * @return #NOTIFICATION_ERROR_NONE on success,
798 * otherwise any other value on failure
799 * @retval #NOTIFICATION_ERROR_NONE Success
800 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
803 #include <notification.h>
806 notification_h noti = NULL;
807 int noti_err = NOTIFICATION_ERROR_NONE;
810 noti_err = notification_get_display_applist(noti, &applist);
811 if (noti_err != NOTIFICATION_ERROR_NONE)
817 int notification_get_display_applist(notification_h noti, int *applist);
821 * @brief Sets the initial size for the ongoing type.
822 * @details After notification_post() call, the size is not updated.
823 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
824 * @param[in] noti The notification handle
825 * @param[in] size The double type size
826 * @return #NOTIFICATION_ERROR_NONE on success,
827 * otherwise any other value on failure
828 * @retval #NOTIFICATION_ERROR_NONE Success
829 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
832 #include <notification.h>
835 notification_h noti = NULL;
836 int noti_err = NOTIFICATION_ERROR_NONE;
838 noti = notification_create(NOTIFICATION_TYPE_NOTI);
842 noti_err = notification_set_size(noti, 0.0);
843 if (noti_err != NOTIFICATION_ERROR_NONE) {
844 notification_free(noti);
850 int notification_set_size(notification_h noti, double size);
854 * @brief Gets the progress size.
855 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
856 * @param[in] noti The notification handle
857 * @param[out] size The progress size
858 * @return #NOTIFICATION_ERROR_NONE on success,
859 * otherwise any other value on failure
860 * @retval #NOTIFICATION_ERROR_NONE Success
861 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
864 #include <notification.h>
867 notification_h noti = NULL;
868 int noti_err = NOTIFICATION_ERROR_NONE;
871 noti_err = notification_get_size(noti, &size);
872 if (noti_err != NOTIFICATION_ERROR_NONE)
877 int notification_get_size(notification_h noti, double *size);
881 * @brief Sets the initial progress for the ongoing type.
882 * @details After the notification_post() call, the progress is not updated.
883 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
884 * @param[in] noti The notification handle
885 * @param[in] percentage The progress percentage
886 * @return #NOTIFICATION_ERROR_NONE on success,
887 * otherwise any other value on failure
888 * @retval #NOTIFICATION_ERROR_NONE Success
889 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
892 #include <notification.h>
895 notification_h noti = NULL;
896 int noti_err = NOTIFICATION_ERROR_NONE;
898 noti = notification_create(NOTIFICATION_TYPE_NOTI);
902 noti_err = notification_set_progress(noti, 0.0);
903 if (noti_err != NOTIFICATION_ERROR_NONE) {
904 notification_free(noti);
910 int notification_set_progress(notification_h noti, double percentage);
914 * @brief Gets the progress from the notification handle.
915 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
916 * @remarks At the end of the operation, the progress should be @c 1.0.
917 * @param[in] noti The notification handle
918 * @param[out] percentage The progress percentage
919 * @return #NOTIFICATION_ERROR_NONE on success,
920 * otherwise any other value on failure
921 * @retval #NOTIFICATION_ERROR_NONE Success
922 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
925 #include <notification.h>
928 notification_h noti = NULL;
929 int noti_err = NOTIFICATION_ERROR_NONE;
930 double percentage = 0.0;
932 noti_err = notification_get_progress(noti, &percentage);
933 if (noti_err != NOTIFICATION_ERROR_NONE)
939 int notification_get_progress(notification_h noti, double *percentage);
943 * @brief Sets the layout of the notification view.
944 * @details Caller can set displaying layout of notification.
945 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
946 * @param[in] noti The notification handle
947 * @param[in] layout The type of layout
948 * @return #NOTIFICATION_ERROR_NONE on success,
949 * otherwise any other value on failure
950 * @retval #NOTIFICATION_ERROR_NONE Success
951 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
952 * @see #notification_ly_type_e
954 int notification_set_layout(notification_h noti, notification_ly_type_e layout);
958 * @brief Gets the layout of the notification view from the notification handle.
959 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
960 * @param[in] noti The notification handle
961 * @param[out] layout The type of layout
962 * @return #NOTIFICATION_ERROR_NONE on success,
963 * otherwise any other value on failure
964 * @retval #NOTIFICATION_ERROR_NONE Success
965 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
966 * @see #notification_ly_type_e
968 int notification_get_layout(notification_h noti, notification_ly_type_e *layout);
972 * @brief Gets the type of a notification.
973 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
974 * @param[in] noti The notification handle
975 * @param[out] type The notification type
976 * @return #NOTIFICATION_ERROR_NONE on success,
977 * otherwise any other value on failure
978 * @retval #NOTIFICATION_ERROR_NONE Success
979 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
982 #include <notification.h>
985 int noti_err = NOTIFICATION_ERROR_NONE;
986 notification_type_e type;
988 noti_err = notification_get_type(noti, &type);
989 if (noti_err != NOTIFICATION_ERROR_NONE)
994 int notification_get_type(notification_h noti, notification_type_e *type);
998 * @brief Updates notification data.
999 * @details The updated notification will appear in the notification area.
1000 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1002 * @privilege %http://tizen.org/privilege/notification
1003 * @param[in] noti The notification handle that is created by notification_create()
1004 * @return #NOTIFICATION_ERROR_NONE on success,
1005 * otherwise any other value on failure
1006 * @retval #NOTIFICATION_ERROR_NONE Success
1007 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1008 * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Priv ID does not exist
1009 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1012 #include <notification.h>
1015 int noti_err = NOTIFICATION_ERROR_NONE;
1017 noti_err = notification_update(NULL);
1018 if (noti_err != NOTIFICATION_ERROR_NONE)
1023 int notification_update(notification_h noti);
1027 * @brief Deletes a notification with the given handle.
1028 * @details notification_delete() removes notification data from database and notification_free() releases memory of notification data.
1029 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1031 * @privilege %http://tizen.org/privilege/notification
1032 * @param[in] noti The notification handle
1033 * @return #NOTIFICATION_ERROR_NONE on success,
1034 * otherwise any other value on failure
1035 * @retval #NOTIFICATION_ERROR_NONE Success
1036 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1037 * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1040 #include <notification.h>
1043 notification_h noti = NULL;
1044 int noti_err = NOTIFICATION_ERROR_NONE;
1048 noti_err = notification_delete(noti);
1049 if (noti_err != NOTIFICATION_ERROR_NONE)
1055 int notification_delete(notification_h noti);
1059 * @brief Creates internal structure data and returns a notification handle.
1060 * @details Available type is #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING.
1061 * #NOTIFICATION_TYPE_NOTI is remaining notification data even if device is restarted.
1062 * #NOTIFICATION_TYPE_ONGOING can display progress on a notification with #NOTIFICATION_LY_ONGOING_PROGRESS layout.
1063 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1064 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1065 * @param[in] type The notification type
1066 * @return Notification handle(notification_h) on success,
1067 * otherwise @c NULL on failure
1068 * @retval notification_h Success
1069 * @retval NULL Failure
1070 * @exception #NOTIFICATION_ERROR_NONE Success
1071 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1072 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1073 * @exception #NOTIFICATION_ERROR_IO_ERROR I/O error
1074 * @see #notification_type_e
1077 #include <notification.h>
1080 notification_h noti = NULL;
1082 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1091 notification_h notification_create(notification_type_e type);
1095 * @brief Creates a notification clone.
1096 * @details Newly created notification handle is returned.
1097 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1098 * @remarks This cloned notification handle should be freed using notification_free().
1099 * @param[in] noti The notification handle
1100 * @param[out] clone The newly created notification handle that has same with input @a noti
1101 * @return #NOTIFICATION_ERROR_NONE if success,
1102 * otherwise any other value if failure
1103 * @retval #NOTIFICATION_ERROR_NONE Success
1104 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1105 * @see #notification_type_e
1108 #include <notification.h>
1111 notification_h noti = notification_create(NOTIFICATION_TYPE_NOTI);
1112 notification_h clone = NULL;
1114 notification_clone(noti, &clone);
1121 int notification_clone(notification_h noti, notification_h *clone);
1125 * @brief Frees the internal structure data of a notification handle.
1126 * @details Internal data of a notification handle is released. Data of the inserted notification is not deleted.
1127 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1128 * @param[in] noti The notification handle
1129 * @return #NOTIFICATION_ERROR_NONE on success,
1130 * otherwise any other value on failure
1131 * @retval #NOTIFICATION_ERROR_NONE Success
1132 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1133 * @pre Notification handle should be created by notification_create().
1136 #include <notification.h>
1139 notification_h noti = NULL;
1140 int noti_err = NOTIFICATION_ERROR_NONE;
1142 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1148 noti_err = notification_free(noti);
1149 if (noti_err != NOTIFICATION_ERROR_NONE)
1155 int notification_free(notification_h noti);
1164 * @addtogroup NOTIFICATION_MODULE
1170 * @brief Sets the tag of the notification handle.
1171 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1172 * @param[in] noti Notification handle
1173 * @param[in] tag Tag for loading notification handle
1174 * @return #NOTIFICATION_ERROR_NONE on success,
1175 * other value on failure
1176 * @retval #NOTIFICATION_ERROR_NONE Success
1177 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1178 * @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 * @see notification_set_tag()
1215 #include <notification.h>
1218 int noti_err = NOTIFICATION_ERROR_NONE;
1219 const char *tag = NULL;
1223 noti_err = notification_get_tag(noti, &tag);
1224 if (noti_err != NOTIFICATION_ERROR_NONE)
1230 int notification_get_tag(notification_h noti, const char **tag);
1234 * @brief Loads a notification from the notification's database with the tag.
1235 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1237 * @privilege %http://tizen.org/privilege/notification
1238 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1239 * @param[in] tag Tag for loading notification handle
1240 * @return Notification handle(notification_h) on success,
1242 * @retval notification_h Success
1243 * @retval NULL Failure
1244 * @exception #NOTIFICATION_ERROR_NONE Success
1245 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1246 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1247 * @exception #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1248 * @see #notification_type_e
1251 #include <notification.h>
1254 notification_h noti = NULL;
1256 noti = notification_load_by_tag(tag);
1265 notification_h notification_load_by_tag(const char *tag);
1269 * @brief Deletes all notifications of the given type.
1270 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1272 * @privilege %http://tizen.org/privilege/notification
1273 * @param[in] type Notification type
1274 * @return #NOTIFICATION_ERROR_NONE if success,
1275 * other value if failure
1276 * @retval #NOTIFICATION_ERROR_NONE Success
1277 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1278 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1281 #include <notification.h>
1284 int noti_err = NOTIFICATION_ERROR_NONE;
1286 noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
1287 if (noti_err != NOTIFICATION_ERROR_NONE)
1293 int notification_delete_all(notification_type_e type);
1297 * @brief Posts a notification.
1298 * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
1300 * @privilege %http://tizen.org/privilege/notification
1301 * @param[in] noti Notification handle
1302 * @return #NOTIFICATION_ERROR_NONE if success,
1303 * other value if failure
1304 * @retval #NOTIFICATION_ERROR_NONE Success
1305 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1306 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1307 * @pre Notification handle should be created by notification_create().
1308 * @post notification_free().
1311 #include <notification.h>
1314 int noti_err = NOTIFICATION_ERROR_NONE;
1316 noti_err = notification_post(noti);
1317 if (noti_err != NOTIFICATION_ERROR_NONE)
1323 int notification_post(notification_h noti);
1327 * @brief Gets the package name of the notification.
1328 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1329 * @param[in] noti Notification handle
1330 * @param[out] pkgname The package name of the notification
1331 * @return #NOTIFICATION_ERROR_NONE on success,
1332 * otherwise a negative error value
1333 * @retval NOTIFICATION_ERROR_NONE Success
1334 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1337 #include <notification.h>
1340 notification_h noti = NULL;
1341 int noti_err = NOTIFICATION_ERROR_NONE;
1342 char *pkgname = NULL;
1346 noti_err = notification_get_pkgname(noti, &pkgname);
1348 if (noti_err != NOTIFICATION_ERROR_NONE) {
1349 notification_free(noti);
1355 int notification_get_pkgname(notification_h noti, char **pkgname);
1359 * @brief Adds a button on the notification.
1360 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1361 * @param[in] noti Notification handle
1362 * @param[in] button_index Button index
1363 * @return #NOTIFICATION_ERROR_NONE on success,
1364 * otherwise a negative error value
1365 * @retval NOTIFICATION_ERROR_NONE Success
1366 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1369 #include <notification.h>
1372 notification_h noti = NULL;
1373 int noti_err = NOTIFICATION_ERROR_NONE;
1374 char *pkgname = NULL;
1378 noti_err = notification_add_button(noti, NOTIFICATION_BUTTON_1);
1380 if (noti_err != NOTIFICATION_ERROR_NONE) {
1381 notification_free(noti);
1387 int notification_add_button(notification_h noti, notification_button_index_e button_index);
1390 * @brief Removes a button on the notification.
1391 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1392 * @param[in] noti Notification handle
1393 * @param[in] button_index Button index
1394 * @return #NOTIFICATION_ERROR_NONE on success,
1395 * otherwise a negative error value
1396 * @retval NOTIFICATION_ERROR_NONE Success
1397 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1400 #include <notification.h>
1403 notification_h noti = NULL;
1404 int noti_err = NOTIFICATION_ERROR_NONE;
1405 char *pkgname = NULL;
1409 noti_err = notification_remove_button(noti, NOTIFICATION_BUTTON_1);
1411 if (noti_err != NOTIFICATION_ERROR_NONE) {
1412 notification_free(noti);
1418 int notification_remove_button(notification_h noti, notification_button_index_e button_index);
1422 * @brief Sets the 'auto remove' option of the active notification.
1423 * @details The 'auto remove' option lets the active notification be removed several seconds after it shows. Default value is true.
1424 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
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 * @param[in] noti Notification handle
1428 * @param[in] auto_remove Auto remove option
1429 * @return #NOTIFICATION_ERROR_NONE On success,
1430 * other value if failure
1431 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1432 * @see #notification_h
1433 * @see #notification_get_auto_remove
1436 #include <notification.h>
1439 notification_h noti = NULL;
1440 int noti_err = NOTIFICATION_ERROR_NONE;
1444 noti_err = notification_set_auto_remove(noti, false);
1445 if (noti_err != NOTIFICATION_ERROR_NONE)
1451 int notification_set_auto_remove(notification_h noti, bool auto_remove);
1455 * @brief Gets the 'auto remove' option of the active notification.
1456 * @details The 'auto remove' option lets the active notification be removed several seconds after it shows. Default value is true.
1457 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
1458 * @param[in] noti Notification handle
1459 * @param[out] auto_remove Auto remove option
1460 * @return #NOTIFICATION_ERROR_NONE On success, other value on failure
1461 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1462 * @see #notification_h
1463 * @see #notification_get_auto_remove
1466 #include <notification.h>
1469 int noti_err = NOTIFICATION_ERROR_NONE;
1474 noti_err = notification_get_auto_remove(noti, &auto_remove);
1475 if (noti_err != NOTIFICATION_ERROR_NONE)
1481 int notification_get_auto_remove(notification_h noti, bool *auto_remove);
1485 * @brief Saves a notification template to the notification database.
1486 * @details An application can save the created notification as a template for later reuse.
1487 * If the template has the same name as a saved one, the saved template will be overwritten.
1488 * A saved template can be loaded only by the application which saved it.
1489 * All templates are removed when the application package is uninstalled.
1492 * @privilege %http://tizen.org/privilege/notification
1493 * @remarks The number of templates is limited to 10.
1494 * When you try to add more than 10 templates, #NOTIFICATION_ERROR_MAX_EXCEEDED will be returned.
1495 * @param[in] noti Notification handle
1496 * @param[in] template_name Template name
1497 * @return #NOTIFICATION_ERROR_NONE On success, other value on failure
1498 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1499 * @retval #NOTIFICATION_ERROR_IO_ERROR I/O error
1500 * @retval #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1501 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The Permission denied
1502 * @retval #NOTIFICATION_ERROR_MAX_EXCEEDED Max notification count exceeded
1503 * @see #notification_h
1504 * @see notification_create_from_template()
1507 #include <notification.h>
1510 int noti_err = NOTIFICATION_ERROR_NONE;
1511 notification_h noti = NULL;
1513 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1517 // add the content you want to use for the template.
1519 noti_err = notification_save_as_template(noti, "CALL_ACCEPT");
1520 if (noti_err != NOTIFICATION_ERROR_NONE)
1523 noti_err = notification_free(noti);
1524 if (noti_err != NOTIFICATION_ERROR_NONE)
1529 int notification_save_as_template(notification_h noti, const char *template_name);
1533 * @brief Loads a notification template from the notification database.
1534 * @details An application can load a saved template and post it.
1535 * An application can load only templates that it has saved.
1538 * @privilege %http://tizen.org/privilege/notification
1539 * @remarks The returned handle should be destroyed using notification_free().
1540 * The specific error code can be obtained using get_last_result().
1541 * Error codes are described in the Exception section.
1542 * If an invalid template name is given, the result will be set to #NOTIFICATION_ERROR_FROM_DB.
1543 * @param[in] template_name Template name
1544 * @return Notification handle on success, NULL on failure
1545 * @exception #NOTIFICATION_ERROR_NONE Success
1546 * @exception #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
1547 * @exception #NOTIFICATION_ERROR_OUT_OF_MEMORY Out of memory
1548 * @exception #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
1549 * @exception #NOTIFICATION_ERROR_FROM_DB Error from DB query
1550 * @see #notification_h
1551 * @see notification_save_as_template()
1554 #include <notification.h>
1557 notification_h noti = NULL;
1559 noti = notification_create_from_template("CALL_ACCEPT");
1566 notification_h notification_create_from_template(const char *template_name);
1570 * @brief Gets notification block state.
1571 * @details The user can set the notification block state in settings.
1572 * The block state indicates whether or not notifications can be posted.
1573 * Additionally only notifications to the notification panel are
1574 * allowed in "Do not disturb mode". Sound, Vibrate and
1575 * Active/Instant notifications are blocked.
1578 * @privilege %http://tizen.org/privilege/notification
1579 * @param[out] state Notification block state
1580 * @return #NOTIFICATION_ERROR_NONE On success, other value on failure
1581 * @retval #NOTIFICATION_ERROR_NONE Success
1582 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1583 * @retval #NOTIFICATION_ERROR_OUT_OF_MEMORY out of memory
1584 * @retval #NOTIFICATION_ERROR_IO_ERROR I/O Error
1585 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED Permission denied
1586 * @retval #NOTIFICATION_ERROR_SERVICE_NOT_READY No response from notification service
1587 * @see #notification_block_state_e
1590 #include <notification.h>
1593 int noti_err = NOTIFICATION_ERROR_NONE;
1594 notification_block_state_e state;
1598 noti_err = notification_get_noti_block_state(&state);
1599 if (noti_err != NOTIFICATION_ERROR_NONE)
1605 int notification_get_noti_block_state(notification_block_state_e *state);
1609 * @brief Sets a text input box to reply directly on the notification.
1610 * @details When you add a text input to the active notification, the notification UI will show a text input with a button.
1611 * So, the user can enter any text and press the button to confirm the text as a input.
1612 * You can edit some UI component that is related to the text input.
1613 * First, you can add placeholder text to guide the user using notification_set_text() with #NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER type.
1614 * You also can edit button for the text input.
1615 * 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.
1616 * 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.
1618 * Note that you should set an app_control for handling the event for user input using notification_set_event_handler().
1619 * #NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON is the event type for the text input.
1620 * You can get the text the user enters in the app_control handle that is passed as a result of the event.
1621 * 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.
1622 * The value will contain the text user enters.
1624 * Note that you are able to make the switching button to the text input box.
1625 * You have to set the app_control which you will set in a text input box to the switching button.
1626 * Refer to the second sample code.
1628 * @param[in] noti Notification handle
1629 * @param[in] text_input_max_length The maximum value which can be inputted
1630 * @return #NOTIFICATION_ERROR_NONE on success,
1631 * otherwise any other value on failure
1632 * @retval #NOTIFICATION_ERROR_NONE Success
1633 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1636 #include <notification.h>
1639 int noti_err = NOTIFICATION_ERROR_NONE;
1640 notification_h noti = NULL;
1643 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1647 noti_err = notification_set_text_input(noti, 160);
1648 if (noti_err != NOTIFICATION_ERROR_NONE)
1651 noti_err = notification_set_text(noti,
1652 NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER,
1655 NOTIFICATION_VARIABLE_TYPE_NONE);
1656 if (noti_err != NOTIFICATION_ERROR_NONE)
1659 noti_err = notification_set_text(noti,
1660 NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON,
1663 NOTIFICATION_VARIABLE_TYPE_NONE);
1664 if (noti_err != NOTIFICATION_ERROR_NONE)
1667 noti_err = notification_set_display_applist(noti,
1668 NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_ACTIVE);
1669 if (noti_err != NOTIFICATION_ERROR_NONE)
1674 noti_err = app_control_create(&app_control);
1675 if (noti_err != APP_CONTROL_ERROR_NONE)
1678 noti_err = app_control_set_app_id(app_control, appid);
1679 if (noti_err != APP_CONTROL_ERROR_NONE)
1682 noti_err = app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
1683 if (noti_err != APP_CONTROL_ERROR_NONE)
1686 noti_err = notification_set_event_handler(noti,
1687 NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON,
1689 if (noti_err != NOTIFICATION_ERROR_NONE)
1692 noti_err = app_control_destroy(app_control);
1693 if (noti_err != APP_CONTROL_ERROR_NONE)
1696 noti_err = notification_post(noti);
1697 if(noti_err != NOTIFICATION_ERROR_NONE)
1704 int noti_err = NOTIFICATION_ERROR_NONE;
1705 notification_h noti = NULL;
1708 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1713 noti_err = notification_set_text_input(noti, 160);
1714 if (noti_err != NOTIFICATION_ERROR_NONE)
1717 noti_err = notification_set_text(noti,
1718 NOTIFICATION_TEXT_TYPE_TEXT_INPUT_PLACEHOLDER,
1721 NOTIFICATION_VARIABLE_TYPE_NONE);
1722 if (noti_err != NOTIFICATION_ERROR_NONE)
1725 noti_err = notification_set_text(noti,
1726 NOTIFICATION_TEXT_TYPE_TEXT_INPUT_BUTTON,
1729 NOTIFICATION_VARIABLE_TYPE_NONE);
1730 if (noti_err != NOTIFICATION_ERROR_NONE)
1733 noti_err = notification_add_button(notification, NOTIFICATION_BUTTON_1);
1734 if (noti_err != NOTIFICATION_ERROR_NONE)
1737 noti_err = notification_set_text(notification,
1738 NOTIFICATION_TEXT_TYPE_BUTTON_1,
1741 NOTIFICATION_VARIABLE_TYPE_NONE);
1742 if (noti_err != NOTIFICATION_ERROR_NONE)
1745 noti_err = notification_set_display_applist(noti,
1746 NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_ACTIVE);
1747 if (noti_err != NOTIFICATION_ERROR_NONE)
1752 noti_err = app_control_create(&app_control);
1753 if (noti_err != APP_CONTROL_ERROR_NONE)
1756 noti_err = app_control_set_app_id(app_control, appid);
1757 if (noti_err != APP_CONTROL_ERROR_NONE)
1760 noti_err = app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
1761 if (noti_err != APP_CONTROL_ERROR_NONE)
1764 noti_err = notification_set_event_handler(notification,
1765 NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1,
1767 if (noti_err != NOTIFICATION_ERROR_NONE)
1770 noti_err = notification_set_event_handler(noti,
1771 NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON,
1773 if (noti_err != NOTIFICATION_ERROR_NONE)
1776 noti_err = app_control_destroy(app_control);
1777 if (noti_err != APP_CONTROL_ERROR_NONE)
1780 noti_err = notification_post(noti);
1781 if(noti_err != NOTIFICATION_ERROR_NONE)
1786 int notification_set_text_input(notification_h noti, int text_input_max_length);
1790 * @brief Sets the image height for the extended notification.
1791 * @details The image is shown under the notification's text. The application can set the image height.
1792 * The image is modified to fit into the height set by this function.
1793 * The image can be scaled down and/or cropped.
1794 * If @a height is 0, the default value is used. The default height depends on the screen size.
1796 * @param[in] noti The notification handle
1797 * @param[in] height The image height
1798 * @return #NOTIFICATION_ERROR_NONE On success,
1799 * otherwise a negative error value
1800 * @retval #NOTIFICATION_ERROR_NONE Success
1801 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1802 * @see notification_get_extension_image_size()
1805 #include <notification.h>
1808 notification_h noti = NULL;
1809 int noti_err = NOTIFICATION_ERROR_NONE;
1811 noti = notification_create(NOTIFICATION_TYPE_NOTI);
1815 noti_err = notification_set_text(noti,
1816 NOTIFICATION_TEXT_TYPE_CONTENT_EXTENTION,
1819 NOTIFICATION_VARIABLE_TYPE_NONE);
1820 if (noti_err != NOTIFICATION_ERROR_NONE)
1823 noti_err = notification_set_image(noti,
1824 NOTIFICATION_IMAGE_TYPE_EXTENTION,
1826 if (noti_err != NOTIFICATION_ERROR_NONE)
1829 noti_err = notification_set_layout(noti, NOTIFICATION_LY_EXTENTION);
1830 if (noti_err != NOTIFICATION_ERROR_NONE)
1833 noti_err = notification_set_extension_image_size(noti, 20);
1834 if (noti_err != NOTIFICATION_ERROR_NONE)
1841 int notification_set_extension_image_size(notification_h noti, int height);
1845 * @brief Gets the image height for the extended notification.
1847 * @param[in] noti The notification handle
1848 * @param[out] height The image height
1849 * @return #NOTIFICATION_ERROR_NONE On success, otherwise a negative error value
1850 * @retval #NOTIFICATION_ERROR_NONE Success
1851 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
1852 * @see notification_set_extension_image_size()
1855 #include <notification.h>
1858 int noti_err = NOTIFICATION_ERROR_NONE;
1863 noti_err = notification_get_extension_image_size(noti, &height);
1864 if (noti_err != NOTIFICATION_ERROR_NONE)
1869 int notification_get_extension_image_size(notification_h noti, int *height);
1878 #endif /* __NOTIFICATION_H__ */