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.
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.
26 #ifndef _FAPP_NOTIFICATION_MANAGER_H_
27 #define _FAPP_NOTIFICATION_MANAGER_H_
30 #include <FAppTypes.h>
32 namespace Tizen { namespace App
37 * The maximum length of the notification message.
39 * @brief <i> [Deprecated] </i>
41 * @deprecated This variable is deprecated. Instead of using this variable, use the Tizen::Shell::MAX_NOTIFICATION_MESSAGE_LENGTH variable.
45 static const int MAX_NOTIFICATION_MESSAGE_LENGTH = 127;
49 * The maximum length of the launch arguments for the notification in bytes.
51 * @brief <i> [Deprecated] </i>
53 * @deprecated This variable is deprecated. Instead of using this variable, use the Tizen::Shell::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH variable.
57 static const int MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH = 1024;
61 * The maximum length of the notification badge number.
63 * @brief <i> [Deprecated] </i>
65 * @deprecated This variable is deprecated. Instead of using this variable, use the Tizen::Shell::MAX_NOTIFICATION_BADGE_NUMBER variable.
69 static const int MAX_NOTIFICATION_BADGE_NUMBER = 999;
73 * @class NotificationManager
74 * @brief <i> [Deprecated] </i> This class provides methods to alert the user about a notification.
76 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
79 * @final This class is not intended for extension.
81 * The %NotificationManager class provides methods to alert the user about a notification.
83 * For more information about the class features, see <a href="../org.tizen.native.appprogramming/html/guide/shell/notifications.htm">Notifications</a>.
85 * The following example demonstrates how to use the %NotificationManager class.
90 * MyClass::NotificationSample(void)
93 * NotificationManager* pNotiMgr = new NotificationManager();
94 * pNotiMgr->Construct();
95 * badgeNumber = pNotiMgr->GetBadgeNumber();
97 * pNotiMgr->Notify(L"A new message has arrived.", badgeNumber);
104 class _OSP_EXPORT_ NotificationManager
105 : public Tizen::Base::Object
111 * This is the default constructor for this class.
113 * @brief <i> [Deprecated] </i>
115 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
119 NotificationManager(void);
123 * This destructor overrides Tizen::Base::Object::~Object().
125 * @brief <i> [Deprecated] </i>
127 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
131 virtual ~NotificationManager(void);
135 * Initializes this instance of %NotificationManager.
137 * @brief <i> [Deprecated] </i>
139 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
142 * @return An error code
143 * @exception E_SUCCESS The method is successful.
144 * @exception E_SYSTEM A system error has occurred.
145 * @exception E_OUT_OF_MEMORY The memory is insufficient.
148 result Construct(void);
152 * Gets the current badge number of the application icon.
154 * @brief <i> [Deprecated] </i>
156 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
158 * @privilege %http://tizen.org/privilege/notification
160 * @return The current badge number
161 * @exception E_SUCCESS The method is successful.
162 * @exception E_SYSTEM A system error has occurred.
163 * @exception E_OBJ_NOT_FOUND The application is not installed.
164 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
165 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
166 * In case of failure, this method returns @c -1.
169 int GetBadgeNumber(void);
173 * Notifies the user using a badge number.
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 An error code
182 * @param[in] badgeNumber The badge number
183 * @exception E_SUCCESS The method is successful.
184 * @exception E_INVALID_ARG The specified input parameter is invalid, or
185 * the specified @c badgeNumber is less than @c 0.
186 * @exception E_SYSTEM A system error has occurred.
187 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
188 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
191 result Notify(int badgeNumber);
195 * Notifies the user using a message.
197 * @brief <i> [Deprecated] </i>
199 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
201 * @privilege %http://tizen.org/privilege/notification
203 * @return An error code
204 * @param[in] messageText The notification message
205 * @exception E_SUCCESS The method is successful.
206 * @exception E_INVALID_ARG The specified input parameter is invalid, or
207 * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
208 * @exception E_SYSTEM A system error has occurred.
209 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
210 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
213 result Notify(const Tizen::Base::String& messageText);
217 * Notifies the user using a message and badge number.
219 * @brief <i> [Deprecated] </i>
221 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
223 * @privilege %http://tizen.org/privilege/notification
225 * @return An error code
226 * @param[in] messageText The notification message
227 * @param[in] badgeNumber The badge number
228 * @exception E_SUCCESS The method is successful.
229 * @exception E_INVALID_ARG The specified @c badgeNumber is less than @c 0, or
230 * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
231 * @exception E_SYSTEM A system error has occurred.
232 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
233 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
236 result Notify(const Tizen::Base::String& messageText, int badgeNumber);
240 * Notifies the user using a message and badge number. @n
241 * If the user checks the message, @c launchArguments is delivered to the application. @n
242 * @c launchArguments is delivered as the value of the %http://tizen.org/appcontrol/data/notification key
243 * for IAppControlProviderEventListener::OnAppControlRequestReceived().
245 * @brief <i> [Deprecated] </i>
247 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
249 * @privilege %http://tizen.org/privilege/notification
251 * @return An error code
252 * @param[in] messageText The notification message
253 * @param[in] badgeNumber The badge number
254 * @param[in] launchArguments The message for application
255 * @exception E_SUCCESS The method is successful.
256 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
257 * - A specified input parameter is invalid. @n
258 * - The specified @c badgeNumber is less than @c 0. @n
259 * - The length of the specified @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
260 * - The length of the specified @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
261 * @exception E_SYSTEM A system error has occurred.
262 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
263 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
264 * @see IAppControlProviderEventListener::OnAppControlRequestReceived()
267 result Notify(const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments);
271 * Removes the notification message.
273 * @brief <i> [Deprecated] </i>
275 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
277 * @privilege %http://tizen.org/privilege/notification
279 * @return An error code
280 * @exception E_SUCCESS The method is successful.
281 * @exception E_SYSTEM A system error has occurred.
282 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
283 * @remarks This method returns @c E_SUCCESS when there is no outstanding notification.
286 result RemoveNotification(void);
290 * Notifies the user about the ongoing activity using a message.
292 * @brief <i> [Deprecated] </i>
294 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
296 * @privilege %http://tizen.org/privilege/notification
298 * @return An error code
299 * @param[in] messageText The notification message
300 * @exception E_SUCCESS The method is successful.
301 * @exception E_INVALID_ARG The specified input parameter is invalid, or
302 * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
303 * @exception E_SYSTEM A system error has occurred.
304 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
305 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
308 result NotifyOngoingActivity(const Tizen::Base::String& messageText);
312 * Notifies the user about the ongoing activity using a message. @n
313 * @c launchArguments is delivered as the value of the %http://tizen.org/appcontrol/data/notification key
314 * for IAppControlProviderEventListener::OnAppControlRequestReceived().
316 * @brief <i> [Deprecated] </i>
318 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
320 * @privilege %http://tizen.org/privilege/notification
322 * @return An error code
323 * @param[in] messageText The notification message
324 * @param[in] launchArguments The launch arguments for the application
325 * @exception E_SUCCESS The method is successful.
326 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
327 * - A specified input parameter is invalid. @n
328 * - The length of the specified @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
329 * - The length of the specified @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
330 * @exception E_SYSTEM A system error has occurred.
331 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
332 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
335 result NotifyOngoingActivity(const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments);
339 * Removes the notification message for the ongoing activity.
341 * @brief <i> [Deprecated] </i>
343 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
345 * @privilege %http://tizen.org/privilege/notification
347 * @return An error code
348 * @exception E_SUCCESS The method is successful.
349 * @exception E_SYSTEM A system error has occurred.
350 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
351 * @remarks This method returns @c E_SUCCESS when there is no outstanding notification.
354 result RemoveOngoingActivityNotification(void);
358 * Gets the badge number of the application icon.
360 * @brief <i> [Deprecated] </i>
362 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
364 * @privilege %http://tizen.org/privilege/notification
366 * @return The current badge number
367 * @param[in] appId The application ID
368 * @exception E_SUCCESS The method is successful.
369 * @exception E_SYSTEM A system error has occurred.
370 * @exception E_OBJ_NOT_FOUND The application is not installed.
371 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
372 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
373 * In case of failure, this method returns @c -1.
376 int GetBadgeNumber(const AppId& appId);
380 * Notifies the user using a badge number on behalf of the specified application.
382 * @brief <i> [Deprecated] </i>
384 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
388 * @privilege %http://tizen.org/privilege/notification @n
389 * (%http://tizen.org/privilege/notificationmanager is deprecated.)
391 * @return An error code
392 * @param[in] appId The application ID
393 * @param[in] badgeNumber The badge number
394 * @exception E_SUCCESS The method is successful.
395 * @exception E_INVALID_ARG A specified input parameter is invalid, or
396 * the specified @c badgeNumber is less than @c 0.
397 * @exception E_APP_NOT_INSTALLED The application is not installed.
398 * @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.
399 * @exception E_SYSTEM A system error has occurred.
400 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
403 result NotifyOnBehalf(const AppId& appId, int badgeNumber);
407 * Notifies the user using a message on behalf of the specified application.
409 * @brief <i> [Deprecated] </i>
411 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
415 * @privilege %http://tizen.org/privilege/notification @n
416 * (%http://tizen.org/privilege/notificationmanager is deprecated.)
418 * @return An error code
419 * @param[in] appId The application ID
420 * @param[in] messageText The notification message
421 * @exception E_SUCCESS The method is successful.
422 * @exception E_INVALID_ARG A specified input parameter is invalid, or
423 * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
424 * @exception E_APP_NOT_INSTALLED The application is not installed.
425 * @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.
426 * @exception E_SYSTEM A system error has occurred.
427 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
430 result NotifyOnBehalf(const AppId& appId, const Tizen::Base::String& messageText);
434 * Notifies the user using a message and badge number on behalf of the specified application.
436 * @brief <i> [Deprecated] </i>
438 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
442 * @privilege %http://tizen.org/privilege/notification @n
443 * (%http://tizen.org/privilege/notificationmanager is deprecated.)
445 * @return An error code
446 * @param[in] appId The application ID
447 * @param[in] messageText The notification message
448 * @param[in] badgeNumber The badge number
449 * @exception E_SUCCESS The method is successful.
450 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
451 * - A specified input parameter is invalid. @n
452 * - The specified @c badgeNumber is less than @c 0. @n
453 * - The length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
454 * @exception E_APP_NOT_INSTALLED The application is not installed.
455 * @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.
456 * @exception E_SYSTEM A system error has occurred.
457 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
460 result NotifyOnBehalf(const AppId& appId, const Tizen::Base::String& messageText, int badgeNumber);
464 * Notifies the user using a message and badge number on behalf of the specified application. @n
465 * If the user checks the message, the @c launchArguments is delivered to the application.
467 * @brief <i> [Deprecated] </i>
469 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
473 * @privilege %http://tizen.org/privilege/notification @n
474 * (%http://tizen.org/privilege/notificationmanager is deprecated.)
476 * @return An error code
477 * @param[in] appId The application ID
478 * @param[in] messageText The notification message
479 * @param[in] launchArguments The launch arguments for the application
480 * @exception E_SUCCESS The method is successful.
481 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
482 * - A specified input parameter is invalid. @n
483 * - The length of the specified @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
484 * - The length of the specified @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
485 * @exception E_APP_NOT_INSTALLED The application is not installed.
486 * @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.
487 * @exception E_SYSTEM A system error has occurred.
488 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
491 result NotifyOnBehalf(const AppId& appId, const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments);
495 * Notifies the user about the ongoing activity using a message on behalf of the specified application.
497 * @brief <i> [Deprecated] </i>
499 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
503 * @privilege %http://tizen.org/privilege/notification @n
504 * (%http://tizen.org/privilege/notificationmanager is deprecated.)
506 * @return An error code
507 * @param[in] appId The application ID
508 * @param[in] messageText The notification message
509 * @exception E_SUCCESS The method is successful.
510 * @exception E_INVALID_ARG The specified input parameter is invalid, or
511 * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
512 * @exception E_APP_NOT_INSTALLED The application is not installed.
513 * @exception E_SYSTEM A system error has occurred.
514 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
515 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
518 result NotifyOngoingActivityOnBehalf(const AppId& appId, const Tizen::Base::String& messageText);
522 * Notifies the user about the ongoing activity using a message on behalf of the specified application.
524 * @brief <i> [Deprecated] </i>
526 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
530 * @privilege %http://tizen.org/privilege/notification @n
531 * (%http://tizen.org/privilege/notificationmanager is deprecated.)
533 * @return An error code
534 * @param[in] appId The application ID
535 * @param[in] messageText The notification message
536 * @param[in] launchArguments The launch arguments for application
537 * @exception E_SUCCESS The method is successful.
538 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
539 * - A specified input parameter is invalid. @n
540 * - The length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
541 * - The length of @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
542 * @exception E_APP_NOT_INSTALLED The application is not installed.
543 * @exception E_SYSTEM A system error has occurred.
544 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the %Tizen platform policy.
545 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
548 result NotifyOngoingActivityOnBehalf(const AppId& appId, const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments);
552 * Removes the notification message for the ongoing activity on behalf of the specified application.
554 * @brief <i> [Deprecated] </i>
556 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
560 * @privilege %http://tizen.org/privilege/notification @n
561 * (%http://tizen.org/privilege/notificationmanager is deprecated.)
563 * @return An error code
564 * @param[in] appId The application ID
565 * @exception E_SUCCESS The method is successful.
566 * @exception E_APP_NOT_INSTALLED The application is not installed.
567 * @exception E_SYSTEM A system error has occurred.
568 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
569 * @remarks Although there is no outstanding notification for the calling application, this method returns @c E_SUCCESS.
572 result RemoveOngoingActivityNotificationOnBehalf(const AppId& appId);
576 * Removes the notification message on behalf of the specified application.
578 * @brief <i> [Deprecated] </i>
580 * @deprecated This class is deprecated. Instead of using this class, use the Tizen::Shell::NotificationManager class.
584 * @privilege %http://tizen.org/privilege/notification @n
585 * (%http://tizen.org/privilege/notificationmanager is deprecated.)
587 * @return An error code
588 * @param[in] appId The application ID
589 * @exception E_SUCCESS The method is successful.
590 * @exception E_APP_NOT_INSTALLED The application is not installed.
591 * @exception E_SYSTEM A system error has occurred.
592 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
593 * @remarks Although there is no outstanding notification for the calling application, this method returns @c E_SUCCESS.
596 result RemoveNotificationOnBehalf(const AppId& appId);
600 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
604 NotificationManager(const NotificationManager& rhs);
607 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
611 NotificationManager& operator =(const NotificationManager& rhs);
614 class _NotificationManagerImpl * __pNotificationManagerImpl;
616 friend class _NotificationManagerImpl;
617 }; // NotificationManager
621 #endif // _FAPP_NOTIFICATION_MANAGER_H_