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 FApp_NotificationManagerImpl.h
19 * @brief This is the header file for the %_NotificationManagerImpl class.
22 #ifndef _FAPP_INTERNAL_NOTIFICATION_MANAGER_IMPL_H_
23 #define _FAPP_INTERNAL_NOTIFICATION_MANAGER_IMPL_H_
25 #include <notification/notification_type.h>
27 #include <FBaseObject.h>
28 #include <FAppTypes.h>
29 #include <FOspConfig.h>
31 namespace Tizen { namespace App
34 class NotificationManager;
36 class _NotificationManagerImpl
41 * This is the default constructor for this class.
45 _NotificationManagerImpl(void);
48 * This is the destructor for this class.
52 virtual ~_NotificationManagerImpl(void);
55 * Initializes this instance of %_NotificationManagerImpl.
58 * @return An error code
59 * @exception E_SUCCESS The method is successful.
60 * @exception E_SYSTEM A system error has occurred.
61 * @exception E_OUT_OF_MEMORY The memory is insufficient.
63 result Construct(void);
66 * Gets the badge number of the application icon.
70 * @return The current badge number
71 * @exception E_SUCCESS The method is successful.
72 * @exception E_SYSTEM A system error has occurred.
73 * @exception E_OBJ_NOT_FOUND The application is not installed.
74 * @exception E_INVALID_STATE This instance is in an invalid state. @n
75 * The Construct() method is not called.
76 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
77 * In case of failure, this method returns @c -1.
79 int GetBadgeNumber(void) const;
82 * Notifies the user using a badge number.
86 * @return An error code
87 * @param[in] badgeNumber The badge number
88 * @exception E_SUCCESS The method is successful.
89 * @exception E_INVALID_ARG The specified input parameter is invalid, or
90 * the specified @c badgeNumber is less than @c 0.
91 * @exception E_SYSTEM A system error has occurred.
92 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the Tizen platform policy.
93 * @exception E_INVALID_STATE This instance is in an invalid state. @n
94 * The Construct() method is not called.
96 result Notify(int badgeNumber) const;
99 * Notifies the user using a message.
103 * @return An error code
104 * @param[in] messageText The notification message
105 * @exception E_SUCCESS The method is successful.
106 * @exception E_INVALID_ARG The specified input parameter is invalid, or
107 * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
108 * @exception E_SYSTEM A system error has occurred.
109 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the Tizen platform policy.
110 * @exception E_INVALID_STATE This instance is in an invalid state. @n
111 * The Construct() method is not called.
113 result Notify(const Tizen::Base::String& messageText) const;
116 * Notifies the user using a message and badge number.
120 * @return An error code
121 * @param[in] messageText The notification message
122 * @param[in] badgeNumber The badge number
123 * @exception E_SUCCESS The method is successful.
124 * @exception E_INVALID_ARG The specified @c badgeNumber is less than @c 0, or
125 * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
126 * @exception E_SYSTEM A system error has occurred.
127 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the Tizen platform policy.
128 * @exception E_INVALID_STATE This instance is in an invalid state. @n
129 * The Construct() method is not called.
131 result Notify(const Tizen::Base::String& messageText, int badgeNumber) const;
134 * Notifies the user using a message and badge number. @n
135 * If the user checks the message, @c launchArguments is delivered to the application. @n
136 * @c launchArguments is specified as input parameter for Application::OnUserEventReceivedN() or can be obtained by
137 * invoking Application::GetAppArgumentListN(), especially within Application::OnAppInitializing().
141 * @return An error code
142 * @param[in] messageText The notification message
143 * @param[in] badgeNumber The badge number
144 * @param[in] launchArguments The message for application
145 * @exception E_SUCCESS The method is successful.
146 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
147 * - A specified input parameter is invalid. @n
148 * - The specified @c badgeNumber is less than @c 0. @n
149 * - The length of the specified @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
150 * - The length of the specified @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
151 * @exception E_SYSTEM A system error has occurred.
152 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the Tizen platform policy.
153 * @exception E_INVALID_STATE This instance is in an invalid state. @n
154 * The Construct() method is not called.
155 * @see Application::OnUserEventReceivedN(), Application::GetAppArgumentListN()
157 result Notify(const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments) const;
160 * Removes the notification message.
164 * @return An error code
165 * @exception E_SUCCESS The method was successful.
166 * @exception E_SYSTEM A system error occurred.
167 * @exception E_INVALID_STATE This instance is in an invalid state: @n
168 * - The Construct() method is not called. @n
169 * @remarks The method returns E_SUCCESS when there is no outstanding notification.
171 result RemoveNotification(void);
174 * Notifies the user about the ongoing activity using a message.
178 * @return An error code
179 * @param[in] messageText The notification message
180 * @exception E_SUCCESS The method is successful.
181 * @exception E_INVALID_ARG The specified input parameter is invalid, or
182 * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
183 * @exception E_SYSTEM A system error has occurred.
184 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the Tizen platform policy.
185 * @exception E_INVALID_STATE This instance is in an invalid state. @n
186 * The Construct() method is not called.
188 result NotifyOngoingActivity(const Tizen::Base::String& messageText) const;
191 * Notifies the user about the ongoing activity using a message. @n
192 * @c launchArguments is specified as input parameter for Application::OnUserEventReceivedN() or can be obtained by
193 * invoking Application::GetAppArgumentListN(), especially within Application::OnAppInitializing().
197 * @return An error code
198 * @param[in] messageText The notification message
199 * @param[in] launchArguments The launch arguments for the application
200 * @exception E_SUCCESS The method is successful.
201 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
202 * - A specified input parameter is invalid. @n
203 * - The length of the specified @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
204 * - The length of the specified @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
205 * @exception E_SYSTEM A system error has occurred.
206 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the Tizen platform policy.
207 * @exception E_INVALID_STATE This instance is in an invalid state. @n
208 * The Construct() method is not called.
209 * @see Application::OnUserEventReceivedN(), Application::GetAppArgumentListN()
211 result NotifyOngoingActivity(const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments) const;
214 * Removes the notification message for the ongoing activity.
218 * @return An error code
219 * @exception E_SUCCESS The method is successful.
220 * @exception E_SYSTEM A system error has occurred.
221 * @exception E_INVALID_STATE This instance is in an invalid state. @n
222 * The Construct() method is not called.
223 * @remarks The method returns E_SUCCESS when there is no outstanding notification.
225 result RemoveOngoingActivityNotification(void);
228 * Gets the badge number of the application icon.
232 * @return The current badge number
233 * @param[in] appId The application ID
234 * @exception E_SUCCESS The method is successful.
235 * @exception E_SYSTEM A system error has occurred.
236 * @exception E_OBJ_NOT_FOUND The application is not installed.
237 * @exception E_INVALID_STATE This instance is in an invalid state. @n
238 * The Construct() method is not called.
239 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
240 * In case of failure, this method returns @c -1.
242 int GetBadgeNumber(const AppId& appId) const;
245 * Notifies the user using a badge number on behalf of the specified application.
249 * @return An error code
250 * @param[in] appId The application ID
251 * @param[in] badgeNumber The badge number
252 * @exception E_SUCCESS The method is successful.
253 * @exception E_INVALID_ARG A specified input parameter is invalid, or
254 * the specified @c badgeNumber is less than @c 0.
255 * @exception E_APP_NOT_INSTALLED The application is not installed.
256 * @exception E_INVALID_OPERATION The target application with the specified application ID is not permitted to get any notification as per the Tizen platform policy.
257 * @exception E_SYSTEM A system error has occurred.
258 * @exception E_INVALID_STATE This instance is in an invalid state. @n
259 * The Construct() method is not called.
261 result NotifyOnBehalf(const AppId& appId, int badgeNumber) const;
264 * Notifies the user using a message on behalf of the specified application.
268 * @return An error code
269 * @param[in] appId The application ID
270 * @param[in] messageText The notification message
271 * @exception E_SUCCESS The method is successful.
272 * @exception E_INVALID_ARG A specified input parameter is invalid, or
273 * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
274 * @exception E_APP_NOT_INSTALLED The application is not installed.
275 * @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.
276 * @exception E_SYSTEM A system error has occurred.
277 * @exception E_INVALID_STATE This instance is in an invalid state. @n
278 * The Construct() method is not called.
280 result NotifyOnBehalf(const AppId& appId, const Tizen::Base::String& messageText) const;
283 * Notifies the user using a message and badge number on behalf of the specified application.
287 * @return An error code
288 * @param[in] appId The application ID
289 * @param[in] messageText The notification message
290 * @param[in] badgeNumber The badge number
291 * @exception E_SUCCESS The method is successful.
292 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
293 * - A specified input parameter is invalid. @n
294 * - The specified @c badgeNumber is less than @c 0. @n
295 * - The length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
296 * @exception E_APP_NOT_INSTALLED The application is not installed.
297 * @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.
298 * @exception E_SYSTEM A system error has occurred.
299 * @exception E_INVALID_STATE This instance is in an invalid state. @n
300 * The Construct() method is not called.
302 result NotifyOnBehalf(const AppId& appId, const Tizen::Base::String& messageText, int badgeNumber) const;
305 * Notifies the user using a message and badge number on behalf of the specified application. @n
306 * If the user checks the message, the @c launchArguments is delivered to the application.
310 * @return An error code
311 * @param[in] appId The application ID
312 * @param[in] messageText The notification message
313 * @param[in] launchArguments The launch arguments for the application
314 * @exception E_SUCCESS The method is successful.
315 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
316 * - A specified input parameter is invalid. @n
317 * - The length of the specified @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
318 * - The length of the specified @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
319 * @exception E_APP_NOT_INSTALLED The application is not installed.
320 * @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.
321 * @exception E_SYSTEM A system error has occurred.
322 * @exception E_INVALID_STATE This instance is in an invalid state. @n
323 * The Construct() method is not called.
325 result NotifyOnBehalf(const AppId& appId, const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments) const;
328 * Notifies the user using a message and badge number on behalf of the specified application. @n
329 * If the user checks the message, the @c launchArguments is delivered to the application.
333 * @return An error code
334 * @param[in] appId The application ID
335 * @param[in] messageText The notification message
336 * @param[in] badgeNumber The badge number
337 * @param[in] launchArguments The launch arguments for the application
338 * @exception E_SUCCESS The method is successful.
339 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
340 * - A specified input parameter is invalid. @n
341 * - The specified @c badgeNumber is less than 0. @n
342 * - The length of the specified @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
343 * - The length of the specified @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
344 * @exception E_APP_NOT_INSTALLED The application is not installed.
345 * @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.
346 * @exception E_SYSTEM A system error has occurred.
347 * @exception E_INVALID_STATE This instance is in an invalid state. @n
348 * The Construct() method is not called.
350 result NotifyOnBehalf(const AppId& appId, const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments) const;
353 * Notifies the user about the ongoing activity using a message on behalf of the specified application.
357 * @return An error code
358 * @param[in] appId The application ID
359 * @param[in] messageText The notification message
360 * @exception E_SUCCESS The method is successful.
361 * @exception E_INVALID_ARG The specified input parameter is invalid, or
362 * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
363 * @exception E_APP_NOT_INSTALLED The application is not installed.
364 * @exception E_SYSTEM A system error has occurred.
365 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the Tizen platform policy.
366 * @exception E_INVALID_STATE This instance is in an invalid state. @n
367 * The Construct() method is not called.
369 result NotifyOngoingActivityOnBehalf(const AppId& appId, const Tizen::Base::String& messageText) const;
372 * Notifies the user about the ongoing activity using a message on behalf of the specified application.
376 * @return An error code
377 * @param[in] appId The application ID
378 * @param[in] messageText The notification message
379 * @param[in] launchArguments The launch arguments for application
380 * @exception E_SUCCESS The method is successful.
381 * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
382 * - A specified input parameter is invalid. @n
383 * - The length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
384 * - The length of @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
385 * @exception E_APP_NOT_INSTALLED The application is not installed.
386 * @exception E_SYSTEM A system error has occurred.
387 * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the Tizen platform policy.
388 * @exception E_INVALID_STATE This instance is in an invalid state. @n
389 * The Construct() method is not called.
391 result NotifyOngoingActivityOnBehalf(const AppId& appId, const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments) const;
394 * Removes the notification message for ongoing activity on behalf of the specified application.
398 * @return An error code
399 * @param[in] appId The application ID
400 * @exception E_SUCCESS The method is successful.
401 * @exception E_APP_NOT_INSTALLED The application is not installed.
402 * @exception E_SYSTEM A system error has occurred.
403 * @exception E_INVALID_STATE This instance is in an invalid state. @n
404 * The Construct() method is not called.
405 * @remarks Although there is no outstanding notification for the calling application, this method returns E_SUCCESS.
407 result RemoveOngoingActivityNotificationOnBehalf(const AppId& appId);
410 * Removes the notification message on behalf of the specified application.
414 * @return An error code
415 * @param[in] appId The application ID
416 * @exception E_SUCCESS The method was successful.
417 * @exception E_APP_NOT_INSTALLED The application is not installed.
418 * @exception E_SYSTEM A system error occurred.
419 * @exception E_INVALID_STATE This instance is in an invalid state: @n
420 * - The Construct() method is not called. @n
421 * @remarks Although there is no outstanding notification for the calling application, this method returns E_SUCCESS.
423 result RemoveNotificationOnBehalf(const AppId& appId);
425 static const _NotificationManagerImpl* GetInstance(const NotificationManager& notiMgr);
427 static _NotificationManagerImpl* GetInstance(NotificationManager& notiMgr);
430 result NotifyImpl(const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments, bool isOngoing = false) const;
432 result NotifyImpl(const AppId& appId, const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments, bool isOngoing = false) const;
434 inline result OngoingImpl(const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments) const;
436 inline result OngoingImpl(const AppId& appId, const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments) const;
438 result RemoveImpl(const AppId& appId, bool isOngoing);
440 result RemoveImpl(const char* pAppId, notification_type_e type);
442 _NotificationManagerImpl(const _NotificationManagerImpl& rhs);
444 _NotificationManagerImpl& operator =(const _NotificationManagerImpl& rhs);
447 }; //_NotificationManagerImpl
451 #endif // _FAPP_INTERNAL_NOTIFICATION_MANAGER_IMPL_H_