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 * @details If @a pkgname is NULL, caller_pkgname is set internally.
360 * @param[in] pkgname Caller application package name or NULL
361 * @param[in] type Notification type
362 * @return NOTIFICATION_ERROR_NONE if success, other value if failure
363 * @retval NOTIFICATION_ERROR_NONE Success
364 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value
367 #include <notification.h>
370 int noti_err = NOTIFICATION_ERROR_NONE;
372 noti_err = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_NOTI);
373 if(noti_err != NOTIFICATION_ERROR_NONE) {
379 NOTIFICATION_DEPRECATED_API int notification_delete_all_by_type(const char *pkgname,
380 notification_type_e type);
384 * @brief This function will be deprecated.
385 * @details If @a pkgname is NULL, caller_pkgname is set internally.
386 * @param[in] pkgname Caller application package name or NULL
387 * @param[in] type Notification type
388 * @param[in] priv_id Priv ID
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_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, APP_PRIV_ID);
400 if(noti_err != NOTIFICATION_ERROR_NONE) {
406 NOTIFICATION_DEPRECATED_API int notification_delete_by_priv_id(const char *pkgname,
407 notification_type_e type,
412 * @brief This function will be deprecated.
413 * @details When notification data selected in display application, application launched by appsvc_run_service with service_handle.
414 * @param[in] noti Notification handle
415 * @param[in] type Notification execute type
416 * @param[in] text Basic text for button
417 * @param[in] key Value for localized text
418 * @param[in] service_handle Appsvc bundle data
419 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
420 * @retval NOTIFICATION_ERROR_NONE Success
421 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
424 #include <notification.h>
427 notification_h noti = NULL;
428 int noti_err = NOTIFICATION_ERROR_NONE;
434 appsvc_set_operation(b, APPSVC_OPERATION_VIEW);
435 appsvc_set_uri(b,"http://www.samsung.com");
437 noti_err = notification_set_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, b);
438 if(noti_err != NOTIFICATION_ERROR_NONE) {
439 notification_free(noti);
447 NOTIFICATION_DEPRECATED_API int notification_set_execute_option(notification_h noti,
448 notification_execute_type_e type,
451 bundle *service_handle);
455 * @brief This function will be deprecated.
456 * @remarks ID is valid only after inserting the notification.
457 * @param[in] noti Notification handle
458 * @param[out] group_id Group ID
459 * @param[out] priv_id Private ID
460 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
461 * @retval NOTIFICATION_ERROR_NONE Success
462 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
465 #include <notification.h>
468 int noti_err = NOTIFICATION_ERROR_NONE;
469 int group_id, priv_id;
471 noti_err = notification_get_id(noti, &group_id, &priv_id);
472 if(noti_err != NOTIFICATION_ERROR_NONE) {
478 NOTIFICATION_DEPRECATED_API int notification_get_id(notification_h noti,
479 int *group_id, int *priv_id);
483 * @brief This function will be deprecated.
484 * @param[in] type Notification type
485 * @param[in] group_id Group ID
486 * @param[in] priv_id Priv ID
487 * @return Notification handle(#notification_h) on success, NULL on failure
488 * @retval #notification_h Success
489 * @retval NULL Failure
490 * @see #notification_type_e
491 * @see #notification_h
494 #include <notification.h>
497 notification_h noti = NULL;
499 noti = notification_load("org.tizen.app", priv_id);
507 NOTIFICATION_DEPRECATED_API notification_h notification_load(char *pkgname,
512 * @brief This function will be deprecated.
513 * @details Available types are #NOTIFICATION_TYPE_NOTI and #NOTIFICATION_TYPE_ONGOING.
514 * #NOTIFICATION_TYPE_NOTI is remaining notification data even if device is restarted.
515 * #NOTIFICATION_TYPE_ONGOING can display progressive feather, but notification data is removed after device is restarted.
516 * If group_id is #NOTIFICATION_GROUP_ID_NONE, notification data is not grouped. #NOTIFICATION_GROUP_ID_DEFAULT,
517 * notification data is grouped with same title. Positive number ( > 0 ) is grouped with same number.
518 * If priv_id is #NOTIFICATION_PRIV_ID_NONE, priv_id is set internally and return it when notification_insert() call.
519 * Positive number and zero ( >= 0 ) is application set private ID. These ID should have be unique each application package.
520 * @param[in] type Notification type
521 * @param[in] group_id Group ID
522 * @param[in] priv_id Priv ID
523 * @return Notification handle(#notification_h) on success, NULL on failure
524 * @retval #notification_h Success
525 * @retval NULL Failure
526 * @see #notification_type_e
527 * @see #notification_h
530 #include <notification.h>
533 notification_h noti = NULL;
535 noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
543 NOTIFICATION_DEPRECATED_API notification_h notification_new(notification_type_e type, int group_id,
548 * @brief This function will be deprecated.
549 * @param[in] noti Notification handle
550 * @param[in] type Notification execute type
551 * @param[out] text Text for button
552 * @param[out] service_handle Appsvc bundle data
553 * @return NOTIFICATION_ERROR_NONE on success, other value on failure
554 * @retval NOTIFICATION_ERROR_NONE Success
555 * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
558 #include <notification.h>
561 notification_h noti = NULL;
562 int noti_err = NOTIFICATION_ERROR_NONE;
567 noti_err = notification_get_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, &b);
568 if(noti_err != NOTIFICATION_ERROR_NONE) {
569 notification_free(noti);
575 NOTIFICATION_DEPRECATED_API int notification_get_execute_option(notification_h noti,
576 notification_execute_type_e type,
578 bundle **service_handle);
582 * @brief This function sets notification property for designated package.
585 * @privilege http://tizen.org/privilege/core/notification
586 * @param[in] pkgname The name of designated package
587 * @param[in] property name
588 * @param[in] property value
589 * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
590 * @see #notification_error_e
592 int notification_setting_property_set(const char *pkgname, const char *property, const char *value);
596 * @brief This function gets notification property for designated package.
599 * @privilege http://tizen.org/privilege/core/notification
600 * @param[in] pkgname The name of designated package
601 * @param[in] property name
602 * @param[in] pointer which can save the getting value
603 * @return #NOTIFICATION_ERROR_NONE if success, other value if failure
606 int notification_setting_property_get(const char *pkgname, const char *property, char **value);