2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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 * @file FAppNotificationManager.h
19 * @brief This is the header file for the %NotificationManager class.
21 * This header file contains the declarations of the %NotificationManager class.
24 #ifndef _FAPP_NOTIFICATION_MANAGER_H_
25 #define _FAPP_NOTIFICATION_MANAGER_H_
28 #include <FAppTypes.h>
30 namespace Tizen { namespace App
35 * The maximum length of the notification message.
37 * @brief <i> [Deprecated] </i>
39 * @deprecated This variable is deprecated. Instead of using this variable, use the Tizen::Shell::MAX_NOTIFICATION_MESSAGE_LENGTH variable.
43 static const int MAX_NOTIFICATION_MESSAGE_LENGTH = 127;
47 * The maximum length of the launch arguments for the notification in bytes.
49 * @brief <i> [Deprecated] </i>
51 * @deprecated This variable is deprecated. Instead of using this variable, use the Tizen::Shell::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH variable.
55 static const int MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH = 1024;
59 * The maximum length of the notification badge number.
61 * @brief <i> [Deprecated] </i>
63 * @deprecated This variable is deprecated. Instead of using this variable, use the Tizen::Shell::MAX_NOTIFICATION_BADGE_NUMBER variable.
67 static const int MAX_NOTIFICATION_BADGE_NUMBER = 999;
71 * @class NotificationManager
72 * @brief <i> [Deprecated] </i> This class provides methods to alert the user about a notification.
74 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
77 * @final This class is not intended for extension.
79 * The %NotificationManager class provides methods to alert the user about a notification.
81 * For more information about the class features, see <a href="../org.tizen.native.appprogramming/html/guide/shell/notifications.htm">Notifications</a>.
83 * The following example demonstrates how to use the %NotificationManager class.
88 * MyClass::NotificationSample(void)
91 * NotificationManager* pNotiMgr = new NotificationManager();
92 * pNotiMgr->Construct();
93 * badgeNumber = pNotiMgr->GetBadgeNumber();
95 * pNotiMgr->Notify(L"A new message has arrived.", badgeNumber);
102 class _OSP_EXPORT_ NotificationManager
103 : public Tizen::Base::Object
109 * This is the default constructor for this class.
111 * @brief <i> [Deprecated] </i>
113 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
117 NotificationManager(void);
121 * This destructor overrides Tizen::Base::Object::~Object().
123 * @brief <i> [Deprecated] </i>
125 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
129 virtual ~NotificationManager(void);
133 * Initializes this instance of %NotificationManager.
135 * @brief <i> [Deprecated] </i>
137 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
140 * @return An error code
141 * @exception E_SUCCESS The method is successful.
142 * @exception E_SYSTEM A system error has occurred.
143 * @exception E_OUT_OF_MEMORY The memory is insufficient.
146 result Construct(void);
150 * Gets the current badge number of the application icon.
152 * @brief <i> [Deprecated] </i>
154 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
156 * @privilege %http://tizen.org/privilege/notification
158 * @return The current badge number
159 * @exception E_SUCCESS The method is successful.
160 * @exception E_SYSTEM A system error has occurred.
161 * @exception E_OBJ_NOT_FOUND The application is not installed.
162 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
163 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
164 * In case of failure, this method returns @c -1.
167 int GetBadgeNumber(void);
171 * Notifies the user using a badge number.
173 * @brief <i> [Deprecated] </i>
175 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
177 * @privilege %http://tizen.org/privilege/notification
179 * @return An error code
180 * @param[in] badgeNumber The badge number
181 * @exception E_SUCCESS The method is successful.
182 * @exception E_INVALID_ARG The specified input parameter is invalid, or
183 * the specified @c badgeNumber is less than @c 0.
184 * @exception E_SYSTEM A system error has occurred.
185 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
186 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
189 result Notify(int badgeNumber);
193 * Notifies the user using a message.
195 * @brief <i> [Deprecated] </i>
197 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
199 * @privilege %http://tizen.org/privilege/notification
201 * @return An error code
202 * @param[in] messageText The notification message
203 * @exception E_SUCCESS The method is successful.
204 * @exception E_INVALID_ARG The specified input parameter is invalid, or
205 * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
206 * @exception E_SYSTEM A system error has occurred.
207 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
208 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
211 result Notify(const Tizen::Base::String& messageText);
215 * Notifies the user using a message and badge number.
217 * @brief <i> [Deprecated] </i>
219 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
221 * @privilege %http://tizen.org/privilege/notification
223 * @return An error code
224 * @param[in] messageText The notification message
225 * @param[in] badgeNumber The badge number
226 * @exception E_SUCCESS The method is successful.
227 * @exception E_INVALID_ARG The specified @c badgeNumber is less than @c 0, 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, int badgeNumber);
238 * Notifies the user using a message and badge number. @n
239 * If the user checks the message, @c launchArguments is delivered to the application. @n
240 * @c launchArguments is delivered as the value of the %http://tizen.org/appcontrol/data/notification key
241 * for IAppControlProviderEventListener::OnAppControlRequestReceived().
243 * @brief <i> [Deprecated] </i>
245 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
247 * @privilege %http://tizen.org/privilege/notification
249 * @return An error code
250 * @param[in] messageText The notification message
251 * @param[in] badgeNumber The badge number
252 * @param[in] launchArguments The message for application
253 * @exception E_SUCCESS The method is successful.
254 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
255 * - A specified input parameter is invalid. @n
256 * - The specified @c badgeNumber is less than @c 0. @n
257 * - The length of the specified @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
258 * - The length of the specified @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
259 * @exception E_SYSTEM A system error has occurred.
260 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
261 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
262 * @see IAppControlProviderEventListener::OnAppControlRequestReceived()
265 result Notify(const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments);
269 * Removes the notification message.
271 * @brief <i> [Deprecated] </i>
273 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
275 * @privilege %http://tizen.org/privilege/notification
277 * @return An error code
278 * @exception E_SUCCESS The method is successful.
279 * @exception E_SYSTEM A system error has occurred.
280 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
281 * @remarks This method returns @c E_SUCCESS when there is no outstanding notification.
284 result RemoveNotification(void);
288 * Notifies the user about the ongoing activity using a message.
290 * @brief <i> [Deprecated] </i>
292 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
294 * @privilege %http://tizen.org/privilege/notification
296 * @return An error code
297 * @param[in] messageText The notification message
298 * @exception E_SUCCESS The method is successful.
299 * @exception E_INVALID_ARG The specified input parameter is invalid, or
300 * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
301 * @exception E_SYSTEM A system error has occurred.
302 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
303 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
306 result NotifyOngoingActivity(const Tizen::Base::String& messageText);
310 * Notifies the user about the ongoing activity using a message. @n
311 * @c launchArguments is delivered as the value of the %http://tizen.org/appcontrol/data/notification key
312 * for IAppControlProviderEventListener::OnAppControlRequestReceived().
314 * @brief <i> [Deprecated] </i>
316 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
318 * @privilege %http://tizen.org/privilege/notification
320 * @return An error code
321 * @param[in] messageText The notification message
322 * @param[in] launchArguments The launch arguments for the application
323 * @exception E_SUCCESS The method is successful.
324 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
325 * - A specified input parameter is invalid. @n
326 * - The length of the specified @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
327 * - The length of the specified @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
328 * @exception E_SYSTEM A system error has occurred.
329 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
330 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
333 result NotifyOngoingActivity(const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments);
337 * Removes the notification message for the ongoing activity.
339 * @brief <i> [Deprecated] </i>
341 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
343 * @privilege %http://tizen.org/privilege/notification
345 * @return An error code
346 * @exception E_SUCCESS The method is successful.
347 * @exception E_SYSTEM A system error has occurred.
348 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
349 * @remarks This method returns @c E_SUCCESS when there is no outstanding notification.
352 result RemoveOngoingActivityNotification(void);
356 * Gets the badge number of the application icon.
358 * @brief <i> [Deprecated] </i>
360 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
362 * @privilege %http://tizen.org/privilege/notification
364 * @return The current badge number
365 * @param[in] appId The application ID
366 * @exception E_SUCCESS The method is successful.
367 * @exception E_SYSTEM A system error has occurred.
368 * @exception E_OBJ_NOT_FOUND The application is not installed.
369 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
370 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
371 * In case of failure, this method returns @c -1.
374 int GetBadgeNumber(const AppId& appId);
378 * Notifies the user using a badge number on behalf of the specified application.
380 * @brief <i> [Deprecated] </i>
382 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
386 * @privilege %http://tizen.org/privilege/notification @n
387 * (%http://tizen.org/privilege/notificationmanager is deprecated.)
389 * @return An error code
390 * @param[in] appId The application ID
391 * @param[in] badgeNumber The badge number
392 * @exception E_SUCCESS The method is successful.
393 * @exception E_INVALID_ARG A specified input parameter is invalid, or
394 * the specified @c badgeNumber is less than @c 0.
395 * @exception E_APP_NOT_INSTALLED The application is not installed.
396 * @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.
397 * @exception E_SYSTEM A system error has occurred.
398 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
401 result NotifyOnBehalf(const AppId& appId, int badgeNumber);
405 * Notifies the user using a message on behalf of the specified application.
407 * @brief <i> [Deprecated] </i>
409 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
413 * @privilege %http://tizen.org/privilege/notification @n
414 * (%http://tizen.org/privilege/notificationmanager is deprecated.)
416 * @return An error code
417 * @param[in] appId The application ID
418 * @param[in] messageText The notification message
419 * @exception E_SUCCESS The method is successful.
420 * @exception E_INVALID_ARG A specified input parameter is invalid, or
421 * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
422 * @exception E_APP_NOT_INSTALLED The application is not installed.
423 * @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.
424 * @exception E_SYSTEM A system error has occurred.
425 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
428 result NotifyOnBehalf(const AppId& appId, const Tizen::Base::String& messageText);
432 * Notifies the user using a message and badge number on behalf of the specified application.
434 * @brief <i> [Deprecated] </i>
436 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
440 * @privilege %http://tizen.org/privilege/notification @n
441 * (%http://tizen.org/privilege/notificationmanager is deprecated.)
443 * @return An error code
444 * @param[in] appId The application ID
445 * @param[in] messageText The notification message
446 * @param[in] badgeNumber The badge number
447 * @exception E_SUCCESS The method is successful.
448 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
449 * - A specified input parameter is invalid. @n
450 * - The specified @c badgeNumber is less than @c 0. @n
451 * - The length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
452 * @exception E_APP_NOT_INSTALLED The application is not installed.
453 * @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.
454 * @exception E_SYSTEM A system error has occurred.
455 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
458 result NotifyOnBehalf(const AppId& appId, const Tizen::Base::String& messageText, int badgeNumber);
462 * Notifies the user using a message and badge number on behalf of the specified application. @n
463 * If the user checks the message, the @c launchArguments is delivered to the application.
465 * @brief <i> [Deprecated] </i>
467 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
471 * @privilege %http://tizen.org/privilege/notification @n
472 * (%http://tizen.org/privilege/notificationmanager is deprecated.)
474 * @return An error code
475 * @param[in] appId The application ID
476 * @param[in] messageText The notification message
477 * @param[in] launchArguments The launch arguments for the application
478 * @exception E_SUCCESS The method is successful.
479 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
480 * - A specified input parameter is invalid. @n
481 * - The length of the specified @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
482 * - The length of the specified @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
483 * @exception E_APP_NOT_INSTALLED The application is not installed.
484 * @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.
485 * @exception E_SYSTEM A system error has occurred.
486 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
489 result NotifyOnBehalf(const AppId& appId, const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments);
493 * Notifies the user about the ongoing activity using a message on behalf of the specified application.
495 * @brief <i> [Deprecated] </i>
497 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
501 * @privilege %http://tizen.org/privilege/notification @n
502 * (%http://tizen.org/privilege/notificationmanager is deprecated.)
504 * @return An error code
505 * @param[in] appId The application ID
506 * @param[in] messageText The notification message
507 * @exception E_SUCCESS The method is successful.
508 * @exception E_INVALID_ARG The specified input parameter is invalid, or
509 * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
510 * @exception E_APP_NOT_INSTALLED The application is not installed.
511 * @exception E_SYSTEM A system error has occurred.
512 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
513 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
516 result NotifyOngoingActivityOnBehalf(const AppId& appId, const Tizen::Base::String& messageText);
520 * Notifies the user about the ongoing activity using a message on behalf of the specified application.
522 * @brief <i> [Deprecated] </i>
524 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
528 * @privilege %http://tizen.org/privilege/notification @n
529 * (%http://tizen.org/privilege/notificationmanager is deprecated.)
531 * @return An error code
532 * @param[in] appId The application ID
533 * @param[in] messageText The notification message
534 * @param[in] launchArguments The launch arguments for application
535 * @exception E_SUCCESS The method is successful.
536 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
537 * - A specified input parameter is invalid. @n
538 * - The length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
539 * - The length of @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
540 * @exception E_APP_NOT_INSTALLED The application is not installed.
541 * @exception E_SYSTEM A system error has occurred.
542 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
543 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
546 result NotifyOngoingActivityOnBehalf(const AppId& appId, const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments);
550 * Removes the notification message for the ongoing activity on behalf of the specified application.
552 * @brief <i> [Deprecated] </i>
554 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
558 * @privilege %http://tizen.org/privilege/notification @n
559 * (%http://tizen.org/privilege/notificationmanager is deprecated.)
561 * @return An error code
562 * @param[in] appId The application ID
563 * @exception E_SUCCESS The method is successful.
564 * @exception E_APP_NOT_INSTALLED The application is not installed.
565 * @exception E_SYSTEM A system error has occurred.
566 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
567 * @remarks Although there is no outstanding notification for the calling application, this method returns @c E_SUCCESS.
570 result RemoveOngoingActivityNotificationOnBehalf(const AppId& appId);
574 * Removes the notification message on behalf of the specified application.
576 * @brief <i> [Deprecated] </i>
578 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
582 * @privilege %http://tizen.org/privilege/notification @n
583 * (%http://tizen.org/privilege/notificationmanager is deprecated.)
585 * @return An error code
586 * @param[in] appId The application ID
587 * @exception E_SUCCESS The method is successful.
588 * @exception E_APP_NOT_INSTALLED The application is not installed.
589 * @exception E_SYSTEM A system error has occurred.
590 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
591 * @remarks Although there is no outstanding notification for the calling application, this method returns @c E_SUCCESS.
594 result RemoveNotificationOnBehalf(const AppId& appId);
598 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
602 NotificationManager(const NotificationManager& rhs);
605 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
609 NotificationManager& operator =(const NotificationManager& rhs);
612 class _NotificationManagerImpl * __pNotificationManagerImpl;
614 friend class _NotificationManagerImpl;
615 }; // NotificationManager
619 #endif // _FAPP_NOTIFICATION_MANAGER_H_