4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 #ifndef __NOTIFICATION_INTERNAL_H__
23 #define __NOTIFICATION_INTERNAL_H__
25 #include <notification_error.h>
26 #include <notification_type.h>
27 #include <notification_list.h>
34 * @addtogroup NOTIFICATION_INTERNAL
38 #define NOTIFICATION_DISPLAY_APP_HEADS_UP NOTIFICATION_DISPLAY_APP_ACTIVE /* To avoid build error */
39 #define NOTIFICATION_ERROR (notification_error_quark ())
40 GQuark notification_error_quark(void);
43 * @brief This function add deferred task. the registered task will be executed when notification service become ready
44 * @param[in] deferred_task_cb The callback function
45 * @param[in] user_data The user data to be passed to the callback function
46 * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
47 * @see #notification_error_e
48 * @see notification_is_service_ready()
50 int notification_add_deferred_task(
51 void (*deferred_task_cb)(void *data), void *user_data);
54 * @brief This function remove deferred task.
55 * @param[in] deferred_task_cb The callback function
56 * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
57 * @see #notification_error_e
58 * @see notification_is_service_ready()
60 int notification_del_deferred_task(
61 void (*deferred_task_cb)(void *data));
64 * @brief This function will be removed.
65 * @see notification_unresister_changed_cb()
68 notification_resister_changed_cb(
69 void (*changed_cb)(void *data, notification_type_e type),
73 * @brief This function will be removed.
74 * @see notification_resister_changed_cb()
77 notification_unresister_changed_cb(
78 void (*changed_cb)(void *data, notification_type_e type));
81 * @brief Updates the progress of the inserted notification. This only works for the ongoing notification (NOTIFICATION_TYPE_ONGOING).
82 * @details The Notification view on the notification area could be updated.
83 * @param[in] noti Notification handle or NULL if priv_id is valid
84 * @param[in] priv_id Private ID
85 * @param[in] progress Percentage value of progressive data
86 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
87 * @retval NOTIFICATION_ERROR_NONE Success
88 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
91 #include <notification.h>
94 int noti_err = NOTIFICATION_ERROR_NONE;
96 noti_err = notification_update_progress(NULL, APP_NOTI_PRIV_ID, 0.6);
97 if(noti_err != NOTIFICATION_ERROR_NONE) {
103 int notification_update_progress(notification_h noti,
108 * @brief Updates the size of inserted notification data. This only works for the ongoing notification (NOTIFICATION_TYPE_ONGOING).
109 * @details Notification view on notification area could be updated.
110 * @param[in] noti Notification handle or NULL if priv_id is valid
111 * @param[in] priv_id Private ID
112 * @param[in] size Bytes of progressive data
113 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
114 * @retval NOTIFICATION_ERROR_NONE Success
115 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
118 #include <notification.h>
121 int noti_err = NOTIFICATION_ERROR_NONE;
123 noti_err = notification_update_size(NULL, APP_NOTI_PRIV_ID, 3000000);
124 if(noti_err != NOTIFICATION_ERROR_NONE) {
130 int notification_update_size(notification_h noti,
131 int priv_id, double size);
134 * @brief Updates the content of the inserted notification data. This is only for the ongoing notification (NOTIFICATION_TYPE_ONGOING).
135 * @details Notification view on notification area could be updated.
136 * @param[in] noti Notification handle or NULL if priv_id is valid
137 * @param[in] priv_id Private ID
138 * @param[in] content Text to update
139 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
140 * @retval NOTIFICATION_ERROR_NONE Success
141 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
144 #include <notification.h>
147 int noti_err = NOTIFICATION_ERROR_NONE;
149 noti_err = notification_update_content(NULL, APP_NOTI_PRIV_ID, "updated string");
150 if(noti_err != NOTIFICATION_ERROR_NONE) {
156 int notification_update_content(notification_h noti,
158 const char *content);
161 * @brief This function will be deprecated.
162 * @see notification_set_image()
165 NOTIFICATION_DEPRECATED_API int notification_set_icon(notification_h noti,
166 const char *icon_path);
169 * @brief This function will be deprecated.
170 * @see notification_get_image()
173 NOTIFICATION_DEPRECATED_API int notification_get_icon(notification_h noti,
177 * @brief This function will be deprecated.
178 * @see notification_set_text()
181 NOTIFICATION_DEPRECATED_API int notification_set_title(notification_h noti,
183 const char *loc_title);
186 * @brief This function will be deprecated.
187 * @see notification_get_text()
190 NOTIFICATION_DEPRECATED_API int notification_get_title(notification_h noti,
195 * @brief This function will be deprecated.
196 * @see notification_set_text()
199 NOTIFICATION_DEPRECATED_API int notification_set_content(notification_h noti,
201 const char *loc_content);
204 * @brief This function will be deprecated.
205 * @see notification_get_text()
208 NOTIFICATION_DEPRECATED_API int notification_get_content(notification_h noti,
213 * @brief This function will be removed.
214 * @see notification_set_execute_option()
217 NOTIFICATION_DEPRECATED_API int notification_set_application(notification_h noti, const char *pkgname); /* Do not use this */
220 * @brief This function will be removed.
221 * @see notification_get_execute_option()
224 NOTIFICATION_DEPRECATED_API int notification_get_application(notification_h noti, char **pkgname); /* Do not use this */
227 * @brief This function will be deprecated.
228 * @see notification_set_execute_option()
231 NOTIFICATION_DEPRECATED_API int notification_set_args(notification_h noti, bundle * args, bundle * group_args); /* Do not use this */
234 * @brief This function will be deprecated.
235 * @see notification_get_execute_option()
238 NOTIFICATION_DEPRECATED_API int notification_get_args(notification_h noti, bundle ** args, bundle ** group_args); /* Do not use this */
241 * @brief This function is deprecated.
242 * @see notification_get_grouping_list()
245 NOTIFICATION_DEPRECATED_API int notification_get_grouping_list(notification_type_e type,
247 notification_list_h *list);
250 * @brief This function will be deprecated.
251 * @see notification_delete_by_priv_id()
254 NOTIFICATION_DEPRECATED_API int notification_delete_group_by_group_id(const char *pkgname,
255 notification_type_e type,
259 * @brief This function will be deprecated.
260 * @see notification_delete_by_priv_id()
263 NOTIFICATION_DEPRECATED_API int notification_delete_group_by_priv_id(const char *pkgname,
264 notification_type_e type,
267 * @brief This function will be deprecated.
270 NOTIFICATION_DEPRECATED_API int notification_get_count(notification_type_e type,
272 int group_id, int priv_id,
276 * @brief This function will be deprecated.
279 NOTIFICATION_DEPRECATED_API int notifiation_clear(notification_type_e type);
283 * @brief This function will be deprecated.
284 * @details Use only for the notification tray's clear button operation.
285 * @param[in] type Notification type
286 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
287 * @retval NOTIFICATION_ERROR_NONE Success
288 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
289 * @see #notification_type_e
292 #include <notification.h>
295 int noti_err = NOTIFICATION_ERROR_NONE;
297 noti_err = notification_clear(NOTIFICATION_TYPE_NOTI);
298 if(noti_err != NOTIFICATION_ERROR_NONE) {
304 NOTIFICATION_DEPRECATED_API int notification_clear(notification_type_e type);
308 * @brief This function will be deprecated.
309 * @return 1 on ready, other value on not ready
311 NOTIFICATION_DEPRECATED_API int notification_is_service_ready(void);
315 * @brief This function will be deprecated.
316 * @param[in] list Notification list handle
317 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
318 * @retval NOTIFICATION_ERROR_NONE Success
319 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
320 * @pre notification_get_grouping_list() or notification_get_detail_list().
321 * @see #notification_op
323 NOTIFICATION_DEPRECATED_API int notification_op_get_data(notification_op *noti_op,
324 notification_op_data_type_e type,
329 * @brief This function will be deprecated.
330 * @details Caller_pkgname is set automatically when notification_new() is called. We do not recommend to use this API.
331 * @param[in] noti Notification handle
332 * @param[in] pkgname Caller package name
333 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
334 * @retval NOTIFICATION_ERROR_NONE Success
335 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
338 #include <notification.h>
341 notification_h noti = NULL;
342 int noti_err = NOTIFICATION_ERROR_NONE;
344 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
349 noti_err = notification_set_pkgname(noti, "org.tizen.phone");
350 if(noti_err != NOTIFICATION_ERROR_NONE) {
351 notification_free(noti);
357 NOTIFICATION_DEPRECATED_API int notification_set_pkgname(notification_h noti,
358 const char *pkgname);
362 * @brief This function will be deprecated.
363 * @details If @a pkgname is NULL, caller_pkgname is set internally.
364 * @param[in] pkgname Caller application package name or NULL
365 * @param[in] type Notification type
366 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
367 * @retval NOTIFICATION_ERROR_NONE Success
368 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
371 #include <notification.h>
374 int noti_err = NOTIFICATION_ERROR_NONE;
376 noti_err = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_NOTI);
377 if(noti_err != NOTIFICATION_ERROR_NONE) {
383 NOTIFICATION_DEPRECATED_API int notification_delete_all_by_type(const char *pkgname,
384 notification_type_e type);
388 * @brief This function will be deprecated.
389 * @details If @a pkgname is NULL, caller_pkgname is set internally.
390 * @param[in] pkgname Caller application package name or NULL
391 * @param[in] type Notification type
392 * @param[in] priv_id Priv ID
393 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
394 * @retval NOTIFICATION_ERROR_NONE Success
395 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
398 #include <notification.h>
401 int noti_err = NOTIFICATION_ERROR_NONE;
403 noti_err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, APP_PRIV_ID);
404 if(noti_err != NOTIFICATION_ERROR_NONE) {
410 NOTIFICATION_DEPRECATED_API int notification_delete_by_priv_id(const char *pkgname,
411 notification_type_e type,
416 * @brief This function will be deprecated.
417 * @details When notification data selected in display application, application launched by appsvc_run_service with service_handle.
418 * @param[in] noti Notification handle
419 * @param[in] type Notification execute type
420 * @param[in] text Basic text for button
421 * @param[in] key Value for localized text
422 * @param[in] service_handle Appsvc bundle data
423 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
424 * @retval NOTIFICATION_ERROR_NONE Success
425 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
428 #include <notification.h>
431 notification_h noti = NULL;
432 int noti_err = NOTIFICATION_ERROR_NONE;
438 appsvc_set_operation(b, APPSVC_OPERATION_VIEW);
439 appsvc_set_uri(b,"http://www.samsung.com");
441 noti_err = notification_set_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, b);
442 if(noti_err != NOTIFICATION_ERROR_NONE) {
443 notification_free(noti);
451 NOTIFICATION_DEPRECATED_API int notification_set_execute_option(notification_h noti,
452 notification_execute_type_e type,
455 bundle *service_handle);
459 * @brief This function will be deprecated.
460 * @remarks ID is valid only after inserting the notification.
461 * @param[in] noti Notification handle
462 * @param[out] group_id Group ID
463 * @param[out] priv_id Private ID
464 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
465 * @retval NOTIFICATION_ERROR_NONE Success
466 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
469 #include <notification.h>
472 int noti_err = NOTIFICATION_ERROR_NONE;
473 int group_id, priv_id;
475 noti_err = notification_get_id(noti, &group_id, &priv_id);
476 if(noti_err != NOTIFICATION_ERROR_NONE) {
482 NOTIFICATION_DEPRECATED_API int notification_get_id(notification_h noti,
483 int *group_id, int *priv_id);
487 * @brief This function will be deprecated.
488 * @param[in] type Notification type
489 * @param[in] group_id Group ID
490 * @param[in] priv_id Priv ID
491 * @return Notification handle(#notification_h) on success, NULL on failure
492 * @retval #notification_h Success
493 * @retval NULL Failure
494 * @see #notification_type_e
495 * @see #notification_h
498 #include <notification.h>
501 notification_h noti = NULL;
503 noti = notification_load("org.tizen.app", priv_id);
511 NOTIFICATION_DEPRECATED_API notification_h notification_load(char *pkgname,
516 * @brief This function will be deprecated.
517 * @details Available types are #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING.
518 * #NOTIFICATION_TYPE_NOTI is remaining notification data even if device is restarted.
519 * #NOTIFICATION_TYPE_ONGOING can display progressive feather, but notification data is removed after device is restarted.
520 * If group_id is #NOTIFICATION_GROUP_ID_NONE, notification data is not grouped. #NOTIFICATION_GROUP_ID_DEFAULT,
521 * notification data is grouped with same title. Positive number ( > 0 ) is grouped with same number.
522 * If priv_id is #NOTIFICATION_PRIV_ID_NONE, priv_id is set internally and return it when notification_insert() call.
523 * Positive number and zero ( >= 0 ) is application set private ID. These ID should have be unique each application package.
524 * @param[in] type Notification type
525 * @param[in] group_id Group ID
526 * @param[in] priv_id Priv ID
527 * @return Notification handle(#notification_h) on success, NULL on failure
528 * @retval #notification_h Success
529 * @retval NULL Failure
530 * @see #notification_type_e
531 * @see #notification_h
534 #include <notification.h>
537 notification_h noti = NULL;
539 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
547 NOTIFICATION_DEPRECATED_API notification_h notification_new(notification_type_e type, int group_id,
552 * @brief This function will be deprecated.
553 * @param[in] noti Notification handle
554 * @param[in] type Notification execute type
555 * @param[out] text Text for button
556 * @param[out] service_handle Appsvc bundle data
557 * @return NOTIFICATION_ERROR_NONE on success, 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 int noti_err = NOTIFICATION_ERROR_NONE;
571 noti_err = notification_get_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, &b);
572 if(noti_err != NOTIFICATION_ERROR_NONE) {
573 notification_free(noti);
579 NOTIFICATION_DEPRECATED_API int notification_get_execute_option(notification_h noti,
580 notification_execute_type_e type,
582 bundle **service_handle);
586 * @brief Inserts a notification.
587 * @details The notification will be inserted to the database and then it will appear in the notification area.
588 * When notification_create() is called, if priv_id is #NOTIFICATION_PRIV_ID_NONE, priv_id returns the internally set priv_id.
591 * @privilege %http://tizen.org/privilege/notification
592 * @param[in] noti The notification handle
593 * @param[out] priv_id The private ID
594 * @return #NOTIFICATION_ERROR_NONE on success,
595 * otherwise any other value on failure
596 * @retval #NOTIFICATION_ERROR_NONE Success
597 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
598 * @retval NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
599 * @pre Notification handle should be created by notification_create().
600 * @post notification_free().
603 #include <notification.h>
606 int noti_err = NOTIFICATION_ERROR_NONE;
608 noti_err = notification_insert(noti, NULL);
609 if(noti_err != NOTIFICATION_ERROR_NONE) {
615 int notification_insert(notification_h noti,
620 * @brief Updates a notification, asynchronously.
621 * @details The updated notification will appear in the notification area.
624 * @privilege %http://tizen.org/privilege/notification
625 * @remarks This function updates the notification asynchronously.
626 * @param[in] noti The notification handle that is created by notification_create()
627 * @param[in] result_cb The callback called when an update completed
628 * @param[in] user_data The user data which you want to use in callback
629 * @return #NOTIFICATION_ERROR_NONE on success,
630 * otherwise any other value on failure
631 * @retval #NOTIFICATION_ERROR_NONE Success
632 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
633 * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Priv ID does not exist
634 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
637 #include <notification.h>
640 int noti_err = NOTIFICATION_ERROR_NONE;
642 noti_err = notification_update_async(NULL, result_cb, data);
643 if(noti_err != NOTIFICATION_ERROR_NONE) {
649 int notification_update_async(notification_h noti,
650 void (*result_cb)(int priv_id, int result, void *data), void *user_data);
654 * @brief Registers a callback for all notification events.
655 * @details The registered callback could be called for all notification events.
658 * @privilege %http://tizen.org/privilege/notification
659 * @param[in] changed_cb The callback function
660 * @param[in] user_data The user data
661 * @return #NOTIFICATION_ERROR_NONE on success,
662 * otherwise any other value on failure
663 * @retval #NOTIFICATION_ERROR_NONE Success
664 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
665 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
666 * @see notification_unregister_detailed_changed_cb()
669 #include <notification.h>
672 noti_err = notification_register_detailed_changed_cb(app_changed_cb, user_data);
673 if(noti_err != NOTIFICATION_ERROR_NONE) {
679 int notification_register_detailed_changed_cb(
680 void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
685 * @brief Unregisters a callback for all notification events.
688 * @privilege %http://tizen.org/privilege/notification
689 * @param[in] changed_cb The callback function
690 * @return #NOTIFICATION_ERROR_NONE on success,
691 * otherwise any other value on failure
692 * @retval #NOTIFICATION_ERROR_NONE Success
693 * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
694 * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
695 * @see notification_register_detailed_changed_cb()
698 #include <notification.h>
701 noti_err = notification_register_detailed_changed_cb(app_changed_cb, user_data);
702 if(noti_err != NOTIFICATION_ERROR_NONE) {
708 int notification_unregister_detailed_changed_cb(
709 void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),