2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FAppNotificationManager.h
20 * @brief This is the header file for the %NotificationManager class.
22 * This header file contains the declarations of the %NotificationManager class.
25 #ifndef _FAPP_NOTIFICATION_MANAGER_H_
26 #define _FAPP_NOTIFICATION_MANAGER_H_
29 #include <FAppTypes.h>
31 namespace Tizen { namespace App
36 * The maximum length of the notification message.
38 * @brief <i> [Deprecated] </i>
40 * @deprecated This variable is deprecated. Instead of using this variable, use the Tizen::Shell::MAX_NOTIFICATION_MESSAGE_LENGTH variable.
44 static const int MAX_NOTIFICATION_MESSAGE_LENGTH = 127;
48 * The maximum length of the launch arguments for the notification in bytes.
50 * @brief <i> [Deprecated] </i>
52 * @deprecated This variable is deprecated. Instead of using this variable, use the Tizen::Shell::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH variable.
56 static const int MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH = 1024;
60 * The maximum length of the notification badge number.
62 * @brief <i> [Deprecated] </i>
64 * @deprecated This variable is deprecated. Instead of using this variable, use the Tizen::Shell::MAX_NOTIFICATION_BADGE_NUMBER variable.
68 static const int MAX_NOTIFICATION_BADGE_NUMBER = 999;
71 * The maximum length of the title text.
75 static const int MAX_NOTIFICATION_TITLE_LENGTH = 1024;
78 * @enum OngoingActivityType
80 * Defines the ongoing activity notification type.
84 enum OngoingActivityType
86 ONGOING_ACTIVITY_TYPE_TEXT = 1, /**< The text type */
87 ONGOING_ACTIVITY_TYPE_PROGRESS_BYTE, /**< The progress type in byte */
88 ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE /**< The progress type in percentage */
94 * @class NotificationManager
95 * @brief <i> [Deprecated] </i> This class provides methods to alert the user about a notification.
97 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
100 * @final This class is not intended for extension.
102 * The %NotificationManager class provides methods to alert the user about a notification.
104 * For more information about the class features, see <a href="../org.tizen.native.appprogramming/html/guide/app/notifications.htm">Notifications</a>.
106 * The following example demonstrates how to use the %NotificationManager class.
111 * MyClass::NotificationSample(void)
114 * NotificationManager* pNotiMgr = new NotificationManager();
115 * pNotiMgr->Construct();
116 * badgeNumber = pNotiMgr->GetBadgeNumber();
118 * pNotiMgr->Notify(L"A new message has arrived.", badgeNumber);
125 class _OSP_EXPORT_ NotificationManager
126 : public Tizen::Base::Object
132 * This is the default constructor for this class.
134 * @brief <i> [Deprecated] </i>
136 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
140 NotificationManager(void);
144 * This destructor overrides Tizen::Base::Object::~Object().
146 * @brief <i> [Deprecated] </i>
148 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
152 virtual ~NotificationManager(void);
156 * Initializes this instance of %NotificationManager.
158 * @brief <i> [Deprecated] </i>
160 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
163 * @return An error code
164 * @exception E_SUCCESS The method is successful.
165 * @exception E_SYSTEM A system error has occurred.
166 * @exception E_OUT_OF_MEMORY The memory is insufficient.
169 result Construct(void);
173 * Gets the current badge number of the application icon.
175 * @brief <i> [Deprecated] </i>
177 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
179 * @privilege %http://tizen.org/privilege/notification
181 * @return The current badge number
182 * @exception E_SUCCESS The method is successful.
183 * @exception E_SYSTEM A system error has occurred.
184 * @exception E_OBJ_NOT_FOUND The application is not installed.
185 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
186 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
187 * In case of failure, this method returns @c -1.
190 int GetBadgeNumber(void);
194 * Notifies the user using a badge number.
196 * @brief <i> [Deprecated] </i>
198 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
200 * @privilege %http://tizen.org/privilege/notification
202 * @return An error code
203 * @param[in] badgeNumber The badge number
204 * @exception E_SUCCESS The method is successful.
205 * @exception E_INVALID_ARG The specified input parameter is invalid, or
206 * the specified @c badgeNumber is less than @c 0.
207 * @exception E_SYSTEM A system error has occurred.
208 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
209 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
212 result Notify(int badgeNumber);
216 * Notifies the user using a message.
218 * @brief <i> [Deprecated] </i>
220 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
222 * @privilege %http://tizen.org/privilege/notification
224 * @return An error code
225 * @param[in] messageText The notification message
226 * @exception E_SUCCESS The method is successful.
227 * @exception E_INVALID_ARG The specified input parameter is invalid, or
228 * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
229 * @exception E_SYSTEM A system error has occurred.
230 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
231 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
234 result Notify(const Tizen::Base::String& messageText);
238 * Notifies the user using a message and badge number.
240 * @brief <i> [Deprecated] </i>
242 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
244 * @privilege %http://tizen.org/privilege/notification
246 * @return An error code
247 * @param[in] messageText The notification message
248 * @param[in] badgeNumber The badge number
249 * @exception E_SUCCESS The method is successful.
250 * @exception E_INVALID_ARG The specified @c badgeNumber is less than @c 0, or
251 * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
252 * @exception E_SYSTEM A system error has occurred.
253 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
254 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
257 result Notify(const Tizen::Base::String& messageText, int badgeNumber);
261 * Notifies the user using a message and badge number. @n
262 * If the user checks the message, @c launchArguments is delivered to the application. @n
263 * @c launchArguments is delivered as the value of the http://tizen.org/appcontrol/data/notification key
264 * for IAppControlProviderEventListener::OnAppControlRequestReceived().
266 * @brief <i> [Deprecated] </i>
268 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
270 * @privilege %http://tizen.org/privilege/notification
272 * @return An error code
273 * @param[in] messageText The notification message
274 * @param[in] badgeNumber The badge number
275 * @param[in] launchArguments The message for application
276 * @exception E_SUCCESS The method is successful.
277 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
278 * - A specified input parameter is invalid. @n
279 * - The specified @c badgeNumber is less than @c 0. @n
280 * - The length of the specified @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
281 * - The length of the specified @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
282 * @exception E_SYSTEM A system error has occurred.
283 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
284 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
285 * @see IAppControlProviderEventListener::OnAppControlRequestReceived()
288 result Notify(const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments);
292 * Removes the notification message.
294 * @brief <i> [Deprecated] </i>
296 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
298 * @privilege %http://tizen.org/privilege/notification
300 * @return An error code
301 * @exception E_SUCCESS The method is successful.
302 * @exception E_SYSTEM A system error has occurred.
303 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
304 * @remarks This method returns @c E_SUCCESS when there is no outstanding notification.
307 result RemoveNotification(void);
311 * Notifies the user about the ongoing activity using a message.
313 * @brief <i> [Deprecated] </i>
315 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
317 * @privilege %http://tizen.org/privilege/notification
319 * @return An error code
320 * @param[in] messageText The notification message
321 * @exception E_SUCCESS The method is successful.
322 * @exception E_INVALID_ARG The specified input parameter is invalid, or
323 * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
324 * @exception E_SYSTEM A system error has occurred.
325 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
326 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
329 result NotifyOngoingActivity(const Tizen::Base::String& messageText);
333 * Notifies the user about the ongoing activity using a message. @n
334 * @c launchArguments is delivered as the value of the http://tizen.org/appcontrol/data/notification key
335 * for IAppControlProviderEventListener::OnAppControlRequestReceived().
337 * @brief <i> [Deprecated] </i>
339 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
341 * @privilege %http://tizen.org/privilege/notification
343 * @return An error code
344 * @param[in] messageText The notification message
345 * @param[in] launchArguments The launch arguments for the application
346 * @exception E_SUCCESS The method is successful.
347 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
348 * - A specified input parameter is invalid. @n
349 * - The length of the specified @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
350 * - The length of the specified @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
351 * @exception E_SYSTEM A system error has occurred.
352 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
353 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
356 result NotifyOngoingActivity(const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments);
360 * Removes the notification message for the ongoing activity.
362 * @brief <i> [Deprecated] </i>
364 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
366 * @privilege %http://tizen.org/privilege/notification
368 * @return An error code
369 * @exception E_SUCCESS The method is successful.
370 * @exception E_SYSTEM A system error has occurred.
371 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
372 * @remarks The method returns @c E_SUCCESS when there is no outstanding notification.
375 result RemoveOngoingActivityNotification(void);
379 * Gets the badge number of the application icon.
381 * @brief <i> [Deprecated] </i>
383 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
385 * @privilege %http://tizen.org/privilege/notification
387 * @return The current badge number
388 * @param[in] appId The application ID
389 * @exception E_SUCCESS The method is successful.
390 * @exception E_SYSTEM A system error has occurred.
391 * @exception E_OBJ_NOT_FOUND The application is not installed.
392 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
393 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
394 * In case of failure, this method returns @c -1.
397 int GetBadgeNumber(const AppId& appId);
402 * Notifies the user using a badge number on behalf of the specified application.
404 * @brief <i> [Deprecated] </i>
406 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
409 * @visibility partner
410 * @privilege %http://tizen.org/privilege/notificationmanager
412 * @return An error code
413 * @param[in] appId The application ID
414 * @param[in] badgeNumber The badge number
415 * @exception E_SUCCESS The method is successful.
416 * @exception E_INVALID_ARG A specified input parameter is invalid, or
417 * the specified @c badgeNumber is less than @c 0.
418 * @exception E_APP_NOT_INSTALLED The application is not installed.
419 * @exception E_INVALID_OPERATION The target application with the specified application ID is not permitted to receive any notification as per the %Tizen platform policy.
420 * @exception E_SYSTEM A system error has occurred.
421 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
425 result NotifyOnBehalf(const AppId& appId, int badgeNumber);
430 * Notifies the user using a message on behalf of the specified application.
432 * @brief <i> [Deprecated] </i>
434 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
437 * @visibility partner
438 * @privilege %http://tizen.org/privilege/notificationmanager
440 * @return An error code
441 * @param[in] appId The application ID
442 * @param[in] messageText The notification message
443 * @exception E_SUCCESS The method is successful.
444 * @exception E_INVALID_ARG A specified input parameter is invalid, or
445 * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
446 * @exception E_APP_NOT_INSTALLED The application is not installed.
447 * @exception E_INVALID_OPERATION The target application with the specified application ID is not permitted to receive any notification as per the %Tizen platform policy.
448 * @exception E_SYSTEM A system error has occurred.
449 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
453 result NotifyOnBehalf(const AppId& appId, const Tizen::Base::String& messageText);
458 * Notifies the user using a message and badge number on behalf of the specified application.
460 * @brief <i> [Deprecated] </i>
462 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
465 * @visibility partner
466 * @privilege %http://tizen.org/privilege/notificationmanager
468 * @return An error code
469 * @param[in] appId The application ID
470 * @param[in] messageText The notification message
471 * @param[in] badgeNumber The badge number
472 * @exception E_SUCCESS The method is successful.
473 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
474 * - A specified input parameter is invalid. @n
475 * - The specified @c badgeNumber is less than @c 0. @n
476 * - The length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
477 * @exception E_APP_NOT_INSTALLED The application is not installed.
478 * @exception E_INVALID_OPERATION The target application with the specified application ID is not permitted to receive any notification as per the %Tizen platform policy.
479 * @exception E_SYSTEM A system error has occurred.
480 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
484 result NotifyOnBehalf(const AppId& appId, const Tizen::Base::String& messageText, int badgeNumber);
489 * Notifies the user using a message and badge number on behalf of the specified application. @n
490 * If the user checks the message, the @c launchArguments is delivered to the application.
492 * @brief <i> [Deprecated] </i>
494 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
497 * @visibility partner
498 * @privilege %http://tizen.org/privilege/notificationmanager
500 * @return An error code
501 * @param[in] appId The application ID
502 * @param[in] messageText The notification message
503 * @param[in] launchArguments The launch arguments for the application
504 * @exception E_SUCCESS The method is successful.
505 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
506 * - A specified input parameter is invalid. @n
507 * - The length of the specified @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
508 * - The length of the specified @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
509 * @exception E_APP_NOT_INSTALLED The application is not installed.
510 * @exception E_INVALID_OPERATION The target application with the specified application ID is not permitted to receive any notification as per the %Tizen platform policy.
511 * @exception E_SYSTEM A system error has occurred.
512 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
516 result NotifyOnBehalf(const AppId& appId, const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments);
521 * Notifies the user about the ongoing activity using a message on behalf of the specified application.
523 * @brief <i> [Deprecated] </i>
525 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
528 * @visibility partner
529 * @privilege %http://tizen.org/privilege/notificationmanager
531 * @return An error code
532 * @param[in] appId The application ID
533 * @param[in] messageText The notification message
534 * @exception E_SUCCESS The method is successful.
535 * @exception E_INVALID_ARG The specified input parameter is invalid, or
536 * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
537 * @exception E_APP_NOT_INSTALLED The application is not installed.
538 * @exception E_SYSTEM A system error has occurred.
539 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
540 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
544 result NotifyOngoingActivityOnBehalf(const AppId& appId, const Tizen::Base::String& messageText);
549 * Notifies the user about the ongoing activity using a message on behalf of the specified application.
551 * @brief <i> [Deprecated] </i>
553 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
556 * @visibility partner
557 * @privilege %http://tizen.org/privilege/notificationmanager
559 * @return An error code
560 * @param[in] appId The application ID
561 * @param[in] messageText The notification message
562 * @param[in] launchArguments The launch arguments for application
563 * @exception E_SUCCESS The method is successful.
564 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
565 * - A specified input parameter is invalid. @n
566 * - The length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
567 * - The length of @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
568 * @exception E_APP_NOT_INSTALLED The application is not installed.
569 * @exception E_SYSTEM A system error has occurred.
570 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
571 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
575 result NotifyOngoingActivityOnBehalf(const AppId& appId, const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments);
580 * Removes the notification message for ongoing activity on behalf of the specified application.
582 * @brief <i> [Deprecated] </i>
584 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
587 * @visibility partner
588 * @privilege %http://tizen.org/privilege/notificationmanager
590 * @return An error code
591 * @param[in] appId The application ID
592 * @exception E_SUCCESS The method is successful.
593 * @exception E_APP_NOT_INSTALLED The application is not installed.
594 * @exception E_SYSTEM A system error has occurred.
595 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
596 * @remarks Although there is no outstanding notification for the calling application, this method returns @c E_SUCCESS.
600 result RemoveOngoingActivityNotificationOnBehalf(const AppId& appId);
605 * Removes the notification message on behalf of the specified application.
607 * @brief <i> [Deprecated] </i>
609 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
612 * @visibility partner
613 * @privilege %http://tizen.org/privilege/notificationmanager
615 * @return An error code
616 * @param[in] appId The application ID
617 * @exception E_SUCCESS The method is successful.
618 * @exception E_APP_NOT_INSTALLED The application is not installed.
619 * @exception E_SYSTEM A system error has occurred.
620 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
621 * @remarks Although there is no outstanding notification for the calling application, this method returns @c E_SUCCESS.
625 result RemoveNotificationOnBehalf(const AppId& appId);
629 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
633 NotificationManager(const NotificationManager& rhs);
636 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
640 NotificationManager& operator =(const NotificationManager& rhs);
643 class _NotificationManagerImpl * __pNotificationManagerImpl;
645 friend class _NotificationManagerImpl;
646 }; // NotificationManager
650 #endif // _FAPP_NOTIFICATION_MANAGER_H_