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
39 * @brief This function add deferred task. the registered task will be executed when notification service become ready
40 * @param[in] deferred_task_cb The callback function
41 * @param[in] user_data The user data to be passed to the callback function
42 * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
43 * @see #notification_error_e
44 * @see notification_is_service_ready()
46 int notification_add_deferred_task(
47 void (*deferred_task_cb)(void *data), void *user_data);
50 * @brief This function remove deferred task.
51 * @param[in] deferred_task_cb The callback function
52 * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
53 * @see #notification_error_e
54 * @see notification_is_service_ready()
56 int notification_del_deferred_task(
57 void (*deferred_task_cb)(void *data));
60 * @brief This function will be removed.
61 * @see notification_unresister_changed_cb()
64 notification_resister_changed_cb(
65 void (*changed_cb)(void *data, notification_type_e type),
69 * @brief This function will be removed.
70 * @see notification_resister_changed_cb()
73 notification_unresister_changed_cb(
74 void (*changed_cb)(void *data, notification_type_e type));
77 * @brief Updates the progress of the inserted notification. This only works for the ongoing notification (NOTIFICATION_TYPE_ONGOING).
78 * @details The Notification view on the notification area could be updated.
79 * @param[in] noti Notification handle or NULL if priv_id is valid
80 * @param[in] priv_id Private ID
81 * @param[in] progress Percentage value of progressive data
82 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
83 * @retval NOTIFICATION_ERROR_NONE Success
84 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
87 #include <notification.h>
90 int noti_err = NOTIFICATION_ERROR_NONE;
92 noti_err = notification_update_progress(NULL, APP_NOTI_PRIV_ID, 0.6);
93 if(noti_err != NOTIFICATION_ERROR_NONE) {
99 int notification_update_progress(notification_h noti,
104 * @brief Updates the size of inserted notification data. This only works for the ongoing notification (NOTIFICATION_TYPE_ONGOING).
105 * @details Notification view on notification area could be updated.
106 * @param[in] noti Notification handle or NULL if priv_id is valid
107 * @param[in] priv_id Private ID
108 * @param[in] size Bytes of progressive data
109 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
110 * @retval NOTIFICATION_ERROR_NONE Success
111 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
114 #include <notification.h>
117 int noti_err = NOTIFICATION_ERROR_NONE;
119 noti_err = notification_update_size(NULL, APP_NOTI_PRIV_ID, 3000000);
120 if(noti_err != NOTIFICATION_ERROR_NONE) {
126 int notification_update_size(notification_h noti,
127 int priv_id, double size);
130 * @brief Updates the content of the inserted notification data. This is only for the ongoing notification (NOTIFICATION_TYPE_ONGOING).
131 * @details Notification view on notification area could be updated.
132 * @param[in] noti Notification handle or NULL if priv_id is valid
133 * @param[in] priv_id Private ID
134 * @param[in] content Text to update
135 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
136 * @retval NOTIFICATION_ERROR_NONE Success
137 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
140 #include <notification.h>
143 int noti_err = NOTIFICATION_ERROR_NONE;
145 noti_err = notification_update_content(NULL, APP_NOTI_PRIV_ID, "updated string");
146 if(noti_err != NOTIFICATION_ERROR_NONE) {
152 int notification_update_content(notification_h noti,
154 const char *content);
157 * @brief This function will be deprecated.
158 * @see notification_set_image()
161 NOTIFICATION_DEPRECATED_API int notification_set_icon(notification_h noti,
162 const char *icon_path);
165 * @brief This function will be deprecated.
166 * @see notification_get_image()
169 NOTIFICATION_DEPRECATED_API int notification_get_icon(notification_h noti,
173 * @brief This function will be deprecated.
174 * @see notification_set_text()
177 NOTIFICATION_DEPRECATED_API int notification_set_title(notification_h noti,
179 const char *loc_title);
182 * @brief This function will be deprecated.
183 * @see notification_get_text()
186 NOTIFICATION_DEPRECATED_API int notification_get_title(notification_h noti,
191 * @brief This function will be deprecated.
192 * @see notification_set_text()
195 NOTIFICATION_DEPRECATED_API int notification_set_content(notification_h noti,
197 const char *loc_content);
200 * @brief This function will be deprecated.
201 * @see notification_get_text()
204 NOTIFICATION_DEPRECATED_API int notification_get_content(notification_h noti,
209 * @brief This function will be removed.
210 * @see notification_set_execute_option()
213 NOTIFICATION_DEPRECATED_API int notification_set_application(notification_h noti, const char *pkgname); /* Do not use this */
216 * @brief This function will be removed.
217 * @see notification_get_execute_option()
220 NOTIFICATION_DEPRECATED_API int notification_get_application(notification_h noti, char **pkgname); /* Do not use this */
223 * @brief This function will be deprecated.
224 * @see notification_set_execute_option()
227 NOTIFICATION_DEPRECATED_API int notification_set_args(notification_h noti, bundle * args, bundle * group_args); /* Do not use this */
230 * @brief This function will be deprecated.
231 * @see notification_get_execute_option()
234 NOTIFICATION_DEPRECATED_API int notification_get_args(notification_h noti, bundle ** args, bundle ** group_args); /* Do not use this */
237 * @brief This function is deprecated.
238 * @see notification_get_grouping_list()
241 NOTIFICATION_DEPRECATED_API int notification_get_grouping_list(notification_type_e type,
243 notification_list_h *list);
246 * @brief This function will be deprecated.
247 * @see notification_delete_by_priv_id()
250 NOTIFICATION_DEPRECATED_API int notification_delete_group_by_group_id(const char *pkgname,
251 notification_type_e type,
255 * @brief This function will be deprecated.
256 * @see notification_delete_by_priv_id()
259 NOTIFICATION_DEPRECATED_API int notification_delete_group_by_priv_id(const char *pkgname,
260 notification_type_e type,
263 * @brief This function will be deprecated.
266 NOTIFICATION_DEPRECATED_API int notification_get_count(notification_type_e type,
268 int group_id, int priv_id,
272 * @brief This function will be deprecated.
275 NOTIFICATION_DEPRECATED_API int notifiation_clear(notification_type_e type);
279 * @brief This function will be deprecated.
280 * @details Use only for the notification tray's clear button operation.
281 * @param[in] type Notification type
282 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
283 * @retval NOTIFICATION_ERROR_NONE Success
284 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
285 * @see #notification_type_e
288 #include <notification.h>
291 int noti_err = NOTIFICATION_ERROR_NONE;
293 noti_err = notification_clear(NOTIFICATION_TYPE_NOTI);
294 if(noti_err != NOTIFICATION_ERROR_NONE) {
300 NOTIFICATION_DEPRECATED_API int notification_clear(notification_type_e type);
304 * @brief This function will be deprecated.
305 * @return 1 on ready, other value on not ready
307 NOTIFICATION_DEPRECATED_API int notification_is_service_ready(void);
311 * @brief This function will be deprecated.
312 * @param[in] list Notification list handle
313 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
314 * @retval NOTIFICATION_ERROR_NONE Success
315 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
316 * @pre notification_get_grouping_list() or notification_get_detail_list().
317 * @see #notification_op
319 NOTIFICATION_DEPRECATED_API int notification_op_get_data(notification_op *noti_op,
320 notification_op_data_type_e type,
325 * @brief This function will be deprecated.
326 * @details Caller_pkgname is set automatically when notification_new() is called. We do not recommend to use this API.
327 * @param[in] noti Notification handle
328 * @param[in] pkgname Caller package name
329 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
330 * @retval NOTIFICATION_ERROR_NONE Success
331 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
334 #include <notification.h>
337 notification_h noti = NULL;
338 int noti_err = NOTIFICATION_ERROR_NONE;
340 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
345 noti_err = notification_set_pkgname(noti, "com.samsung.phone");
346 if(noti_err != NOTIFICATION_ERROR_NONE) {
347 notification_free(noti);
353 NOTIFICATION_DEPRECATED_API int notification_set_pkgname(notification_h noti,
354 const char *pkgname);
358 * @brief This function will be deprecated.
359 * @param[in] noti Notification handle
360 * @param[out] pkgname Caller package name
361 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
362 * @retval NOTIFICATION_ERROR_NONE Success
363 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
366 #include <notification.h>
369 notification_h noti = NULL;
370 int noti_err = NOTIFICATION_ERROR_NONE;
371 char *pkgname = NULL;
373 noti_err = notification_get_pkgname(noti, &pkgname);
374 if(noti_err != NOTIFICATION_ERROR_NONE) {
380 NOTIFICATION_DEPRECATED_API int notification_get_pkgname(notification_h noti,
385 * @brief This function will be deprecated.
386 * @details If @a pkgname is NULL, caller_pkgname is set internally.
387 * @param[in] pkgname Caller application package name or NULL
388 * @param[in] type Notification type
389 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
390 * @retval NOTIFICATION_ERROR_NONE Success
391 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
394 #include <notification.h>
397 int noti_err = NOTIFICATION_ERROR_NONE;
399 noti_err = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_NOTI);
400 if(noti_err != NOTIFICATION_ERROR_NONE) {
406 NOTIFICATION_DEPRECATED_API int notification_delete_all_by_type(const char *pkgname,
407 notification_type_e type);
411 * @brief This function will be deprecated.
412 * @details If @a pkgname is NULL, caller_pkgname is set internally.
413 * @param[in] pkgname Caller application package name or NULL
414 * @param[in] type Notification type
415 * @param[in] priv_id Priv ID
416 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
417 * @retval NOTIFICATION_ERROR_NONE Success
418 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
421 #include <notification.h>
424 int noti_err = NOTIFICATION_ERROR_NONE;
426 noti_err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, APP_PRIV_ID);
427 if(noti_err != NOTIFICATION_ERROR_NONE) {
433 NOTIFICATION_DEPRECATED_API int notification_delete_by_priv_id(const char *pkgname,
434 notification_type_e type,
439 * @brief This function will be deprecated.
440 * @details When notification data selected in display application, application launched by appsvc_run_service with service_handle.
441 * @param[in] noti Notification handle
442 * @param[in] type Notification execute type
443 * @param[in] text Basic text for button
444 * @param[in] key Value for localized text
445 * @param[in] service_handle Appsvc bundle data
446 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
447 * @retval NOTIFICATION_ERROR_NONE Success
448 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
451 #include <notification.h>
454 notification_h noti = NULL;
455 int noti_err = NOTIFICATION_ERROR_NONE;
461 appsvc_set_operation(b, APPSVC_OPERATION_VIEW);
462 appsvc_set_uri(b,"http://www.samsung.com");
464 noti_err = notification_set_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, b);
465 if(noti_err != NOTIFICATION_ERROR_NONE) {
466 notification_free(noti);
474 NOTIFICATION_DEPRECATED_API int notification_set_execute_option(notification_h noti,
475 notification_execute_type_e type,
478 bundle *service_handle);
482 * @brief This function will be deprecated.
483 * @remarks ID is valid only after inserting the notification.
484 * @param[in] noti Notification handle
485 * @param[out] group_id Group ID
486 * @param[out] priv_id Private ID
487 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
488 * @retval NOTIFICATION_ERROR_NONE Success
489 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
492 #include <notification.h>
495 int noti_err = NOTIFICATION_ERROR_NONE;
496 int group_id, priv_id;
498 noti_err = notification_get_id(noti, &group_id, &priv_id);
499 if(noti_err != NOTIFICATION_ERROR_NONE) {
505 NOTIFICATION_DEPRECATED_API int notification_get_id(notification_h noti,
506 int *group_id, int *priv_id);
510 * @brief This function will be deprecated.
511 * @param[in] type Notification type
512 * @param[in] group_id Group ID
513 * @param[in] priv_id Priv ID
514 * @return Notification handle(#notification_h) on success, NULL on failure
515 * @retval #notification_h Success
516 * @retval NULL Failure
517 * @see #notification_type_e
518 * @see #notification_h
521 #include <notification.h>
524 notification_h noti = NULL;
526 noti = notification_load("org.tizen.app", priv_id);
534 NOTIFICATION_DEPRECATED_API notification_h notification_load(char *pkgname,
539 * @brief This function will be deprecated.
540 * @details Available types are #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING.
541 * #NOTIFICATION_TYPE_NOTI is remaining notification data even if device is restarted.
542 * #NOTIFICATION_TYPE_ONGOING can display progressive feather, but notification data is removed after device is restarted.
543 * If group_id is #NOTIFICATION_GROUP_ID_NONE, notification data is not grouped. #NOTIFICATION_GROUP_ID_DEFAULT,
544 * notification data is grouped with same title. Positive number ( > 0 ) is grouped with same number.
545 * If priv_id is #NOTIFICATION_PRIV_ID_NONE, priv_id is set internally and return it when notification_insert() call.
546 * Positive number and zero ( >= 0 ) is application set private ID. These ID should have be unique each application package.
547 * @param[in] type Notification type
548 * @param[in] group_id Group ID
549 * @param[in] priv_id Priv ID
550 * @return Notification handle(#notification_h) on success, NULL on failure
551 * @retval #notification_h Success
552 * @retval NULL Failure
553 * @see #notification_type_e
554 * @see #notification_h
557 #include <notification.h>
560 notification_h noti = NULL;
562 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
570 NOTIFICATION_DEPRECATED_API notification_h notification_new(notification_type_e type, int group_id,
575 * @brief This function will be deprecated.
576 * @param[in] noti Notification handle
577 * @param[in] type Notification execute type
578 * @param[out] text Text for button
579 * @param[out] service_handle Appsvc bundle data
580 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
581 * @retval NOTIFICATION_ERROR_NONE Success
582 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
585 #include <notification.h>
588 notification_h noti = NULL;
589 int noti_err = NOTIFICATION_ERROR_NONE;
594 noti_err = notification_get_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, &b);
595 if(noti_err != NOTIFICATION_ERROR_NONE) {
596 notification_free(noti);
602 NOTIFICATION_DEPRECATED_API int notification_get_execute_option(notification_h noti,
603 notification_execute_type_e type,
605 bundle **service_handle);
609 * @brief This function sets notification property for designated package.
612 * @privilege http://tizen.org/privilege/core/notification
613 * @param[in] pkgname The name of designated package
614 * @param[in] property name
615 * @param[in] property value
616 * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
617 * @see #notification_error_e
619 int notification_setting_property_set(const char *pkgname, const char *property, const char *value);
623 * @brief This function gets notification property for designated package.
626 * @privilege http://tizen.org/privilege/core/notification
627 * @param[in] pkgname The name of designated package
628 * @param[in] property name
629 * @param[in] pointer which can save the getting value
630 * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
633 int notification_setting_property_get(const char *pkgname, const char *property, char **value);