sync with tizen_2.0
[platform/framework/native/appfw.git] / inc / FAppAppManager.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17
18 /**
19  * @file        FAppAppManager.h
20  * @brief       This is the header file for the %AppManager class.
21  *
22  * This header file contains the declarations of the %AppManager class.
23  */
24
25 #ifndef _FAPP_APP_MANAGER_H_
26 #define _FAPP_APP_MANAGER_H_
27
28 #include <FBaseObject.h>
29 #include <FAppTypes.h>
30
31 namespace Tizen { namespace Base {
32 class ByteBuffer;
33 namespace Collection {
34 class IList;
35 class IMap;
36 }
37 }}
38
39 namespace Tizen { namespace App
40 {
41
42 class IAppControlEventListener;
43 class IAppControlListener;
44 class IAppControlResponseListener;
45 class IAppCheckpointEventListener;
46 class IAppLaunchConditionEventListener;
47 class IActiveAppEventListener;
48 class AppControl;
49 class SqlDataControl;
50 class MapDataControl;
51
52 /**
53  * @class               AppManager
54  * @brief               This class manages all the applications.
55  *
56  * @since       2.0
57  *
58  * @final       This class is not intended for extension.
59  *
60  * The %AppManager class manages all the applications.
61  * The application manager supports normal and conditional application launch, and application control search and launch.
62  * It looks up the specific application control from the application control registry and creates an application control instance.
63  * @n
64  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/app/launching_other_apps_within_apps.htm">Launching Other Applications</a>, <a href="../org.tizen.native.appprogramming/html/guide/app/registering_launch_condition.htm">Registering a Launch Condition</a>, and <a href="../org.tizen.native.appprogramming/html/guide/app/app_controls.htm">Application Controls</a>.
65  */
66 class _OSP_EXPORT_ AppManager
67         : public Tizen::Base::Object
68 {
69 public:
70         /**
71          * @enum LaunchOption
72          *
73          * Defines the launch options.
74          *
75          * @since       2.0
76          */
77         enum LaunchOption
78         {
79                 LAUNCH_OPTION_DEFAULT   /**< The launch option: default */
80         };
81
82         /**
83          * Finds the application control that the caller wants to start. @n
84          * It resolves the matched application control with the delivered application ID and operation ID.
85          *
86          * @since       2.0
87          *
88          * @return      A pointer to the newly created AppControl instance if a matched %AppControl is found, @n
89          *                      else @c null
90          * @param[in]   appId                   The application ID
91          * @param[in]   operationId             The operation ID
92          * @exception   E_SUCCESS               The method is successful.
93          * @exception   E_OBJ_NOT_FOUND The application control is not found.
94          * @exception   E_SYSTEM                A system error has occurred. @n
95          *                                                              Either the file operation or the DB operation has failed.
96          * @remarks     The specific error code can be accessed using the GetLastResult() method.
97          * @remarks     %Tizen platform defines platform-defined alias for application ID and this aliased application ID
98          *                      can be used to find the AppControl. For more information, see
99          *                      <a href="../org.tizen.native.appprogramming/html/guide/app/app_controls.htm">here</a>.
100          *
101          * The following example demonstrates how to use the %FindAppControlN() method to find the application control.
102          *
103          * @code
104          * ArrayList dataList(SingleObjectDeleter);
105          * dataList.Construct();
106          * dataList.Add(new String(L"tel:1234567900"));
107          * dataList.Add(new String(L"type:voice"));
108          *
109          * AppControl* pAc = AppManager::FindAppControlN(L"tizen.phone", L"http://tizen.org/appcontrol/operation/call");
110          * pAc->Start(&dataList, null);
111          * @endcode
112          */
113         static AppControl* FindAppControlN(const AppId& appId, const Tizen::Base::String& operationId);
114
115         /**
116          * Finds a list of AppControl instances that matches the specified operation ID, category,
117          * data type, and URI pattern.
118          *
119          * @since               2.0
120          *
121          * @return      A pointer to the list of the AppControl instances that matches the specified operation ID, category, URI, and data type, @n
122          *          else @c null if it fails
123          * @param[in]   pOperationId    The operation ID
124          * @param[in]   pCategory                       The application category
125          * @param[in]   pDataType       The MIME type (RFC 2046) or file extension @n
126          *                          The '.' prefix must be used when specifying the file extension.
127          * @param[in]   pUriPattern                     The URI pattern
128          *
129          * @exception   E_SUCCESS                       The method is successful.
130          * @exception   E_INVALID_ARG           At least one of the specified @c pOperationId, @c pCategory, @c pDataType, or @c pUriScheme must not be @c null.
131          * @exception   E_INVALID_FORMAT        The specified URI scheme is invalid (RFC 2396).
132          * @exception   E_UNSUPPORTED_FORMAT    The specified file extension for @c pDataType is not supported.
133          * @exception   E_OBJ_NOT_FOUND         The application control is not found.
134          * @exception   E_SYSTEM                A system error has occurred. @n
135          *                                                              Either the file operation or the DB operation has failed.
136          * @remarks     The specific error code can be accessed using the GetLastResult() method.
137          * @remarks     For the delivered launch arguments, see App::GetAppArgumentListN().
138          */
139         static Tizen::Base::Collection::IList* FindAppControlsN(const Tizen::Base::String* pOperationId, const Tizen::Base::String* pCategory, const Tizen::Base::String* pDataType, const Tizen::Base::String* pUriPattern);
140
141         /**
142          * @if OSPDEPREC
143          * Starts the application control if there is only one application control that matches the specified URI, operation ID, and data type. @n
144          * If there are more than one application controls, the one that the user selects is started.
145          *
146          * @brief       <i> [Deprecated] </i>
147          * @deprecated  This method is deprecated because IAppControlListener is deprecated and replaced by IAppControlResponselistener.
148          *                              Instead of using this method, use AppControl::FindAndStart().
149          * @since               2.0
150          * @privilege   %http://tizen.org/privilege/application.launch
151          *
152          * @return      An error code
153          * @param[in]   uriData                 The URI that has a maximum size of @c 1024 bytes
154          * @param[in]   pOperationId    The operation ID
155          * @param[in]   pDataType       The MIME type (RFC 2046) or file extension @n
156          *                          The '.' prefix must be used for the @c dataType when specifying the file extension.
157          * @param[in]   pListener       A listener that gets notified when the resolved application control has started
158          * @exception   E_SUCCESS                       The method is successful.
159          * @exception   E_MAX_EXCEEDED          The size of @c uri has exceeded the maximum limit.
160          * @exception   E_UNSUPPORTED_FORMAT    The specified file extension for @c pDataType is not supported.
161          * @exception   E_OUT_OF_MEMORY The memory is insufficient.
162          * @exception   E_OBJ_NOT_FOUND         The application control is not found.
163          * @exception   E_IN_PROGRESS           The target application control is in progress.
164          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
165          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
166          *
167          * @see App::GetAppArgumentListN()
168          * @see FindAppControlN()
169          * @see FindAppControlsN()
170          * @see AppControl::Start()
171          *
172          * The following example demonstrates how to use the %StartAppControl() method.
173          * @code
174          * String operationId = L"http://tizen.org/appcontrol/operation/call";
175          * StartAppControl(L"tel:1234567890", &operationId, null, null);
176          * @endcode
177          * @endif
178          */
179         static result StartAppControl(const Tizen::Base::String& uriData, const Tizen::Base::String* pOperationId, const Tizen::Base::String* pDataType, IAppControlListener* pListener);
180
181         /**
182          * @if OSPDEPREC
183          * Starts the application control if there is only one application control that matches the specified operation ID, category, URI, and data type. @n
184          * If there are more than one application controls, the one that the user selects is started.
185          *
186          * @brief       <i> [Deprecated] </i>
187          * @deprecated  This method is deprecated because IAppControlListener is deprecated and replaced by IAppControlResponselistener.
188          *                              Instead of using this method, use AppControl::FindAndStart().
189          * @since               2.0
190          * @privilege   %http://tizen.org/privilege/application.launch
191          *
192          * @return      An error code
193          * @param[in]   pOperationId    The operation ID
194          * @param[in]   pCategory                       The application control category
195          * @param[in]   pDataType       The MIME type (RFC 2046) or file extension @n
196          *                          The '.' prefix must be used when specifying the file extension.
197          * @param[in]   pUriPattern                     A URI pattern which is used for application control resolution and delivered as the argument
198          * @param[in]   pDataList       The data list that is delivered to the resolved application control @n
199          *                       It has a maximum size of @c 1024 bytes.
200          * @param[in]   pListener       A listener that gets notified when the resolved application control has started
201          * @exception   E_SUCCESS                       The method is successful.
202          * @exception   E_INVALID_ARG           At least one of the specified @c pOperationId, @c pCategory, @c pDataType, or @c pUri must not be @c null.
203          * @exception   E_MAX_EXCEEDED          The size of @c pDataList has exceeded the maximum limit.
204          * @exception   E_UNSUPPORTED_FORMAT    The specified file extension for @c pDataType is not supported.
205          * @exception   E_OBJ_NOT_FOUND         The application control is not found.
206          * @exception   E_IN_PROGRESS           The target application control is in progress.
207          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
208          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
209          * @remarks             For delivered launch arguments, see App::GetAppArgumentListN().
210          * @see App::GetAppArgumentListN()
211          * @see FindAppControlsN()
212          * @see AppControl::Start()
213          * @endif
214          */
215         static result StartAppControl(const Tizen::Base::String* pOperationId, const Tizen::Base::String* pCategory, const Tizen::Base::String* pDataType, const Tizen::Base::String* pUriPattern, const Tizen::Base::Collection::IList* pDataList, IAppControlListener* pListener);
216
217         /**
218          * Gets the SQL-type data control that the caller wants to use. @n
219          * It resolves the matching data control with the specified data control provider ID.
220          *
221          * @since       2.0
222          *
223          * @return              A pointer to the SqlDataControl instance if a matching data control is found, @n
224          *                              else @c null
225          * @param[in]   providerId                      The provider ID
226          * @exception   E_SUCCESS                       The method is successful.
227          * @exception   E_OBJ_NOT_FOUND         The data control specified with the @c providerId is not found.
228          * @exception   E_ILLEGAL_ACCESS        The access is denied due to insufficient permission.
229          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
230          * @exception   E_SYSTEM                        A system error has occurred.
231          * @remarks             The specific error code can be accessed using the GetLastResult() method.
232          */
233         static SqlDataControl* GetSqlDataControlN(const Tizen::Base::String& providerId);
234
235         /**
236          * Gets the MAP-type data control that the caller wants to use. @n
237          * It resolves the matching data control with the specified data control provider ID.
238          *
239          * @since       2.0
240          *
241          * @return              A pointer to the MapDataControl instance if a matching data control is found, @n
242          *                              else @c null
243          * @param[in]   providerId                      The provider ID
244          * @exception   E_SUCCESS                       The method is successful.
245          * @exception   E_OBJ_NOT_FOUND         The data control specified with the @c providerId is not found.
246          * @exception   E_ILLEGAL_ACCESS        The access is denied due to insufficient permission.
247          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
248          * @exception   E_SYSTEM                        A system error has occurred.
249          * @remarks             The specific error code can be accessed using the GetLastResult() method.
250          */
251         static MapDataControl* GetMapDataControlN(const Tizen::Base::String& providerId);
252
253         /**
254         * Gets the path of the read-only shared directory exported by an other application specified with an application ID.
255         *
256         * @since        2.0
257         *
258         * @return               The other application's shared directory path, @n
259         *                               else an empty string if an exception occurs
260         * @param[in]    appId                           The application ID
261         * @exception    E_SUCCESS                       The method is successful.
262         * @exception    E_APP_NOT_INSTALLED     The expected shared directory cannot be found
263         *                                                                       because the application specified with @c appId cannot be installed.
264         * @remarks              The specific error code can be accessed using the GetLastResult() method.
265         */
266         static Tizen::Base::String GetAppSharedPath(const AppId& appId);
267
268         /**
269          * Gets the application manager instance.
270          *
271          * @since       2.0
272          *
273          * @return      A pointer to the %AppManager instance, @n
274          *                      else @c null if it fails
275          */
276         static AppManager* GetInstance(void);
277
278         /**
279          * @if OSPDEPREC
280          * Launches the default application with given @c appId. @n
281          * The launch arguments are given as App::OnUserEventReceivedN() or can be obtained by
282          * invoking App::GetAppArgumentListN(), especially within App::OnAppInitializing().
283          *
284          * @brief               <i> [Deprecated] </i>
285          * @deprecated  This method is deprecated because sending argument with %LaunchApplication() is not recommended. @n
286          *                              Instead of using this method, use %LaunchApplication() without launch arguments or AppControl::Start().
287          * @since       2.0
288          * @privilege   %http://tizen.org/privilege/application.launch
289          *
290          * @return      An error code
291          * @param[in]   appId                           The application's ID to execute
292          * @param[in]   pArguments                      A pointer to the list of string arguments that has a maximum size of @c 1024 bytes
293          * @param[in]   option                          The launch option (currently only AppManager::LAUNCH_OPTION_DEFAULT is available)
294          * @exception   E_SUCCESS                       The method is successful.
295          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
296          * @exception   E_INVALID_ARG           The specified @c appId is empty.
297          * @exception   E_OBJ_NOT_FOUND         The target application is not installed.
298          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
299          * @exception   E_MAX_EXCEEDED          The size of @c appId or @c pArguments has exceeded the maximum limit.
300          * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
301          * @endif
302          */
303         result LaunchApplication(const AppId& appId, const Tizen::Base::Collection::IList* pArguments, LaunchOption option = LAUNCH_OPTION_DEFAULT);
304
305         /**
306          * Launches the default application with given @c appId.
307          *
308          * @since       2.0
309          * @privilege   %http://tizen.org/privilege/application.launch
310          *
311          * @return      An error code
312          * @param[in]   appId                           The application's ID to execute
313          * @param[in]   option                          The launch option (currently only AppManager::LAUNCH_OPTION_DEFAULT is available)
314          * @exception   E_SUCCESS                       The method is successful.
315          * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
316          * @exception   E_APP_NOT_INSTALLED     The target application is not installed.
317          * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
318          */
319         result LaunchApplication(const AppId& appId, LaunchOption option = LAUNCH_OPTION_DEFAULT);
320
321         /**
322          * @if VISPARTNER
323          * Terminates an application.
324          *
325          * @since       2.0
326          * @visibility  partner
327          * @privilege   %http://tizen.org/privilege/application.kill
328          *
329          * @return      An error code
330          * @param[in]   appId                           The application's ID to execute
331          * @exception   E_SUCCESS                       The method is successful.
332          * @exception   E_SYSTEM                        A system error has occurred.
333          * @exception   E_OBJ_NOT_FOUND         The application is not installed or not running.
334          * @exception   E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
335          * @endif
336          */
337         result TerminateApplication(const AppId& appId);
338
339         /**
340          * Checks whether an application is running.
341          *
342          * @since       2.0
343          *
344          * @return      @c true if the application is running, @n
345          *           else @c false
346          * @param[in]   appId               The installed application ID
347          */
348         bool IsRunning(const AppId& appId) const;
349
350         /**
351          * Gets a list of running applications at the time of invocation.
352          *
353          * @since      2.0
354          *
355          * @return      A pointer to the running state application list (AppId), @n
356          *                   else @c null if an error occurs
357          * @exception   E_SUCCESS                       The method is successful.
358          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
359          * @exception   E_SYSTEM                        A system error has occurred.
360          * @remarks     The specific error code can be accessed using the GetLastResult() method.
361          */
362         Tizen::Base::Collection::IList* GetRunningAppListN(void) const;
363
364         /**
365          * Registers an application with a specific condition and launches it if the condition is met. @n
366          * If the requested application is already running, the application is notified through IAppLaunchConditionEventListener::OnAppLaunchConditionMetN().
367          * The launch arguments are given as input parameters to %IAppLaunchConditionEventListener::OnAppLaunchConditionMetN().
368          *
369          * @since       2.0
370          * @privilege   %http://tizen.org/privilege/application.launch
371          *
372          * @return              An error code
373          * @param[in]   condition         The launch condition for the application @n
374          *                                                        The condition has L"Key='value'" format and is case sensitive. To use single or double quotes in the condition values, prefix them with a slash (\' or \"). @n
375          *                                                        For more information on the condition formats, see <a href="../org.tizen.native.appprogramming/html/guide/app/registering_launch_condition.htm">Registering a Launch Condition</a>.
376          *                            <table><tr><th>Condition Format</th><th>Meaning</th></tr>
377                                       <tr><td>L"DateTime='mm/dd/yyyy hh:mm:ss'"</td>
378                                       <td>The specified condition is the local due time.</td></tr>
379                                       <tr><td>L"DueTime='mm/dd/yyyy hh:mm:ss' LaunchPeriod='mm'"</td>
380                                       <td>The specific condition is the time period after due time.</td></tr>
381                                       <tr><td>L"Serial='command'"</td><td>The specified condition is a serial
382                                       communication input command.</td></tr>
383                                       <tr><td>L"NFC='command'"</td><td>The specified condition is a Near Field Communication (NFC) tag that has the NFC Data Exchange Format (NDEF) data.
384                                       </td></tr></table> @n
385
386          *
387          * @param[in]   pArguments        A list of string arguments that has a maximum size of @c 1024 bytes @n
388          *                                                        The parameter can also contain @c null. @n
389          *                                                    For more information on the arguments, see <a href="../org.tizen.native.appprogramming/html/guide/app/launching_other_apps_within_apps.htm">Launching Other Applications</a>.
390          * @param[in]   option         The launch option (currently only AppManager::LAUNCH_OPTION_DEFAULT is available)
391          * @exception   E_SUCCESS                       The method is successful.
392          * @exception   E_INVALID_ARG           The launch condition is empty or too long (Maximum 400 bytes).
393          * @exception   E_INVALID_FORMAT                The specified condition format is invalid.
394          * @exception   E_INVALID_CONDITION  The specified condition format is valid but the condition has at least one or more invalid values.
395          * @exception   E_OBJ_ALREADY_EXIST     The specified @c condition is already registered by a different application.
396          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
397          * @exception   E_MAX_EXCEEDED          The size of @c pArguments has exceeded the maximum limit.
398          * @exception   E_SYSTEM                                A system error has occurred.
399          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
400          *
401          * @remarks             When the registered application is about to be launched, the registered launch condition and arguments are given as parameters to IAppLaunchConditionEventListener::OnAppLaunchConditionMetN().
402          * @remarks             The newly introduced launch condition does not work on the previous SDK version and the E_INVALID_CONDITION exception is returned.
403          * @remarks             Registering the same launch condition overwrites the previous launch argument without throwing an exception.
404          * @remarks             The launch period requires more consideration because an inappropriate short period value may lead
405          *                              to an adverse effect on the device battery.
406          * @remarks             For the NFC launch condition, the detected NDEF message can be acquired using the @c pExtraData parameter of %IAppLaunchConditionEventListener::OnAppLaunchConditionMetN() method.
407          * @see                 UnregisterAppLaunch()
408          * @see                 IsAppLaunchRegistered()
409          * @see                 LaunchApplication()
410          * @see                 Tizen::Base::DateTime::ToString()
411          * @see                 Tizen::Io::SerialPort
412          *
413          * The following example demonstrates how to use the %RegisterAppLaunch() method.
414          *
415          * @code
416          *
417          *  DateTime time;
418          *  SystemTime::GetCurrentTime(TIME_MODE_WALL, time);
419          *  time.AddMinutes(1);
420          *
421          *  String cond;
422          *  cond.Format(70, L"DueTime='%S' LaunchPeriod='60'", time.ToString().GetPointer());
423          *
424          *  // Registers a periodic condition that fires every 60 minutes starting after one minute
425          *  AppManager::GetInstance()->RegisterAppLaunch(cond, null, AppManager::LAUNCH_OPTION_DEFAULT)
426          *
427          * @endcode
428          */
429         result RegisterAppLaunch(const Tizen::Base::String& condition, const Tizen::Base::Collection::IList* pArguments, LaunchOption option);
430
431         /**
432          * Unregisters the previously registered launch condition.
433          *
434          * @since       2.0
435          * @privilege   %http://tizen.org/privilege/application.launch
436          *
437          * @return              An error code
438          * @exception   E_SUCCESS                       The method is successful.
439          * @exception   E_SYSTEM                        A system error has occurred.
440          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
441          * @remarks             E_SUCCESS                       An error occurs when there is no registered launch condition.
442          * @see                 RegisterAppLaunch()
443          * @see                 IsAppLaunchRegistered()
444          */
445         result UnregisterAppLaunch(void);
446
447         /**
448          * Unregisters the specified launch condition.
449          *
450          * @since               2.0
451          * @privilege   %http://tizen.org/privilege/application.launch
452          *
453          * @return              An error code
454          * @param[in]   condition                       The launch condition for the application
455          * @exception   E_SUCCESS                       The method is successful.
456          * @exception   E_OBJ_NOT_FOUND         The specified launch condition is not found.
457          * @exception   E_SYSTEM                        A system error has occurred.
458          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
459          * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
460          * @see                 RegisterAppLaunch()
461          * @see                 IsAppLaunchRegistered()
462          */
463         result UnregisterAppLaunch(const Tizen::Base::String& condition);
464
465         /**
466          * Checks whether a launch condition is registered for the application.
467          *
468          * @since       2.0
469          *
470          * @return     @c true if a condition is already registered to the application invoking this method, @n
471          *             else @c false
472          * @exception  E_SUCCESS                        The method is successful.
473          * @exception  E_SYSTEM                         A system error has occurred.
474          *
475          * @remarks     The specific error code can be accessed using the GetLastResult() method.
476          * @see         RegisterAppLaunch()
477          * @see         UnregisterAppLaunch()
478          */
479         bool IsAppLaunchRegistered(void) const;
480
481         /**
482          * @if VISPARTNER
483          * Registers the specified application with a specific condition and launches it if the condition is met. @n
484          * If the requested application is already running, the application is notified through IAppLaunchConditionEventListener::OnAppLaunchConditionMetN().
485          * The launch arguments are given as input parameters to %IAppLaunchConditionEventListener::OnAppLaunchConditionMetN().
486          *
487          * @since               2.0
488          * @visibility  partner
489          * @privilege   %http://tizen.org/privilege/appmanager.launch
490          *
491          * @return     An error code
492          * @param[in]  appId          The ID of the application registered for launch
493          * @param[in]  condition      The launch condition for the application @n
494          *                                The condition has L"Key='value'" format and is case sensitive. To use single or double quotes in the condition values, prefix them with a slash (\' or \"). @n
495          *                                                        For more information on the condition formats, see <a href="../org.tizen.native.appprogramming/html/guide/app/registering_launch_condition.htm">Registering a Launch Condition</a>.
496          *                             <table><tr><th>Condition Format</th><th>Meaning</th></tr>
497                                      <tr><td>L"DateTime='mm/dd/yyyy hh:mm:ss'"</td>
498                                      <td>The specified condition is the local due time.</td></tr>
499                                      <tr><td>L"DueTime='mm/dd/yyyy hh:mm:ss' LaunchPeriod='mm'"</td>
500                                      <td>The specific condition is the time period after due time.</td></tr>
501                                      <tr><td>L"Serial='command'"</td><td>The specified condition is a serial
502                                      communication input command.</td></tr>
503                                      <tr><td>L"NFC='command'"</td><td>The specified condition is a Near Field Communication (NFC) tag that has the NFC Data Exchange Format (NDEF) data.
504                                      </td></tr></table> @n
505
506          *
507          * @param[in]  pArguments         A list of string arguments that has a maximum size of @c 1024 bytes @n
508          *                                                        The parameter can also contain @c null. @n
509          *                                                    For more information on the arguments, see <a href="../org.tizen.native.appprogramming/html/guide/app/launching_other_apps_within_apps.htm">Launching Other Applications</a>.
510          * @param[in]  option         The launch option (currently only AppManager::LAUNCH_OPTION_DEFAULT is available)
511          * @exception  E_SUCCESS                        The method is successful.
512          * @exception  E_APP_NOT_INSTALLED      The application is not installed.
513          * @exception  E_INVALID_ARG            The launch condition is empty or too long (Maximum 400 bytes).
514          * @exception  E_INVALID_FORMAT         The specified condition format is invalid.
515          * @exception  E_INVALID_CONDITION  The specified condition format is valid but the condition has at least one or more invalid values.
516          * @exception  E_OUT_OF_MEMORY          The memory is insufficient.
517          * @exception  E_MAX_EXCEEDED           The size of @c pArguments has exceeded the maximum limit.
518          * @exception  E_SYSTEM                         A system error has occurred.
519          * @exception  E_PRIVILEGE_DENIED       The application does not have the privilege to call this method.
520          *
521          * @remarks    When the registered application is about to be launched, the registered launch condition and arguments are given as parameters to IAppLaunchConditionEventListener::OnAppLaunchConditionMetN().
522          * @remarks    The newly introduced launch condition does not work on the previous SDK version and the E_INVALID_CONDITION exception is returned.
523          * @remarks    Registering the same launch condition overwrites the previous launch argument without throwing an exception.
524          * @remarks    The launch period requires more consideration because an inappropriate short period value may lead
525          *             to an adverse effect on the device battery.
526          * @remarks    For the NFC launch condition, the detected NDEF message can be acquired using the @c pExtraData parameter of %IAppLaunchConditionEventListener::OnAppLaunchConditionMetN() method.
527          * @see        UnregisterAppLaunch()
528          * @see        IsAppLaunchRegistered()
529          * @see        LaunchApplication()
530          * @see        IAppLaunchConditionEventListener::OnAppLaunchConditionMetN()
531          * @see        Tizen::Base::DateTime::ToString()
532          * @see        Tizen::Io::SerialPort
533          * @endif
534          */
535         result RegisterAppLaunch(const AppId& appId, const Tizen::Base::String& condition, const Tizen::Base::Collection::IList* pArguments, LaunchOption option);
536
537         /**
538          * @if VISPARTNER
539          * Unregisters the launch condition.
540          *
541          * @since               2.0
542          * @visibility  partner
543          * @privilege   %http://tizen.org/privilege/appmanager.launch
544          *
545          * @return     An error code
546          * @param[in]  appId          The application ID
547          * @param[in]  pCondition           The launch condition to unregister @n
548          *                                  If the parameter contains @c null, all the conditions are unregistered.
549          * @exception  E_SUCCESS                        The method is successful.
550          * @exception  E_APP_NOT_INSTALLED      The application is not installed.
551          * @exception  E_OBJ_NOT_FOUND          The specified launch condition is not found.
552          * @exception  E_SYSTEM                         A system error has occurred.
553          * @exception  E_OUT_OF_MEMORY          The memory is insufficient.
554          * @exception  E_PRIVILEGE_DENIED       The application does not have the privilege to call this method.
555          *
556          * @see         RegisterAppLaunch()
557          * @see         IsAppLaunchRegistered()
558          * @endif
559          */
560         result UnregisterAppLaunch(const AppId& appId, const Tizen::Base::String* pCondition);
561
562         /**
563          * @if VISPARTNER
564          * Checks whether a previously registered launch condition is present for the specified application.
565          *
566          * @since               2.0
567          * @visibility  partner
568          * @privilege   %http://tizen.org/privilege/appmanager.launch
569          *
570          * @return     @c true if a condition is already registered to the specified application with the specified condition, @n
571          *             else @c false
572          * @param[in]  appId          The application ID
573          * @param[in]  pCondition     The launch condition to register for the specified @c appId @n
574          *                            If the parameter contains @c null, the method checks for any registered launch condition for the specified @c appId.
575          * @exception  E_SUCCESS                        The method is successful.
576          * @exception  E_APP_NOT_INSTALLED      The application is not installed.
577          * @exception  E_SYSTEM                         A system error has occurred.
578          * @exception  E_OUT_OF_MEMORY          The memory is insufficient.
579          * @exception  E_PRIVILEGE_DENIED       The application does not have the privilege to call this method.
580          *
581          * @remarks     The specific error code can be accessed using the GetLastResult() method.
582          * @see         RegisterAppLaunch()
583          * @see         UnregisterAppLaunch()
584          * @endif
585          */
586         bool IsAppLaunchRegistered(const AppId& appId, const Tizen::Base::String* pCondition = null) const;
587
588         /**
589          * Sets a checkpoint event listener. @n
590          * The listener gets notified when a checkpoint event is fired.
591          *
592          * @since       2.0
593          *
594          * @return      An error code
595          * @param[in]   listener                The listener to receive the checkpoint event
596          * @exception  E_SUCCESS                        The method is successful.
597          * @exception  E_OBJ_ALREADY_EXIST      The listener is already set.
598          * @exception  E_SYSTEM         A system error has occurred.
599          * @see         IAppCheckpointEventListener
600          *
601          */
602         result SetCheckpointEventListener(IAppCheckpointEventListener& listener);
603
604         /**
605          * @if OSPDEPREC
606          * Sends the result list for the application control request. @n
607          * The client can get the result list by implementing IAppControlEventListener::OnAppControlCompleted().
608          *
609          * @brief       <i> [Deprecated] </i>
610          * @deprecated  This method is deprecated because a new method has been added. @n
611          *                      Instead of using this method, use AppControlProviderManager::SendAppControlResult().
612          * @since               2.0
613          *
614          * @return              An error code
615          * @param[in]   appControlRequestId     The application control request ID @n
616          *                          The application control request ID is given as an argument for
617          *                          App::GetAppArgumentListN() or App::OnUserEventReceivedN().
618          * @param[in]   pResultList     The list of the result strings of the application control
619          * @exception   E_SUCCESS                               The method is successful.
620          * @exception   E_OBJ_NOT_FOUND                 The application control request is not found.
621          * @exception   E_OUT_OF_MEMORY                 The memory is insufficient.
622          * @exception   E_SYSTEM                                A system error has occurred.
623          * @see IAppControlEventListener
624          * @endif
625          */
626         static result SendAppControlResult(const Tizen::Base::String& appControlRequestId, const Tizen::Base::Collection::IList* pResultList);
627
628         /**
629      * Sets an IAppLaunchConditionEventListener to the %AppManager. @n
630      * The listener gets notified when the application is launched by the registered condition.
631      *
632      * @since   2.0
633          *
634      * @param[in]  pListener      The event listener @n
635      *                            To unset the listener, pass a @c null value to the listener parameter.
636      * @remarks    If the application is newly launched by the condition, then %SetAppLaunchConditionEventListener() must
637      *             be set within App::OnAppInitializing().
638      *             If the application does not set the listener using %SetAppLaunchConditionEventListener(),
639      *             then the application is launched without invoking any listener for the condition.
640      * @see RegisterAppLaunch()
641      */
642         void SetAppLaunchConditionEventListener(IAppLaunchConditionEventListener* pListener);
643
644         /**
645          * @if VISPARTNER
646          * Adds an IActiveAppEventListener to the %AppManager. @n
647          * The listener gets notified when the active application is changed.
648          *
649          * @since       2.0
650          *
651          * @visibility  partner
652          * @privilege   %http://tizen.org/privilege/appusage
653          *
654          * @return              An error code
655          * @param[in]   listener                                The event listener
656          * @exception   E_SUCCESS                               The method is successful.
657          * @exception   E_OUT_OF_MEMORY                 The memory is insufficient.
658          * @exception   E_OBJ_ALREADY_EXIST             The listener is already added.
659          * @exception   E_SYSTEM                                The method cannot proceed due to a severe system error.
660          * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
661          * @remarks             Active application is the top most window with focus.
662          * @see                 GetActiveApp()
663          * @see                 RemoveActiveAppEventListener()
664          * @see                 IActiveAppEventListener
665          * @endif
666          */
667         result AddActiveAppEventListener(IActiveAppEventListener& listener);
668
669         /**
670          * @if VISPARTNER
671          * Removes an IActiveAppEventListener from the %AppManager.
672          *
673          * @since       2.0
674          *
675          * @visibility  partner
676          * @privilege   %http://tizen.org/privilege/appusage
677          *
678          * @return              An error code
679          * @param[in]   listener                                The event listener
680          * @exception   E_SUCCESS                               The method is successful.
681          * @exception   E_OBJ_NOT_FOUND                 The specified @c listener is not found.
682          * @exception   E_SYSTEM                                The method cannot proceed due to a severe system error.
683          * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
684          * @see                 GetActiveApp()
685          * @see                 AddActiveAppEventListener()
686          * @see                 IActiveAppEventListener
687          * @endif
688          */
689         result RemoveActiveAppEventListener(IActiveAppEventListener& listener);
690
691         /**
692          * @if VISPARTNER
693          * Gets the current active application AppId.
694          *
695          * @since       2.0
696          *
697          * @visibility  partner
698          * @privilege   %http://tizen.org/privilege/appusage
699          *
700          * @return              An error code
701          * @param[out]  appId                                   The AppId of the active application
702          * @exception   E_SUCCESS                               The method is successful.
703          * @exception   E_SYSTEM                                The method cannot proceed due to a severe system error.
704          * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
705          * @remarks             Active application is the top most window with focus.
706          * @see                 AddActiveAppEventListener()
707          * @see                 RemoveActiveAppEventListener()
708          * @endif
709          */
710         result GetActiveApp(AppId& appId);
711
712 private:
713         /**
714          * This default constructor is intentionally declared as private to implement the %Singleton semantic.
715          *
716          * @since       2.0
717          */
718         AppManager(void);
719
720         /**
721          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
722          *
723          * @since       2.0
724          */
725         AppManager(const AppManager& rhs);
726
727         /**
728          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
729          *
730          * @since       2.0
731          */
732         AppManager& operator =(const AppManager& rhs);
733
734         /**
735          * Constructs the instance of this class.
736          *
737          * @since       2.0
738          *
739          * @return          An error code
740          * @exception   E_SUCCESS       The method is successful.
741          * @exception   E_OUT_OF_MEMORY The memory is insufficient.
742          * @exception   E_SYSTEM                        A system error has occurred.
743          */
744         result Construct(void);
745
746         /**
747          * This destructor is intentionally declared as private to implement the %Singleton semantic.
748          *
749          * @since       2.0
750          */
751         virtual ~AppManager(void);
752
753 private:
754         class _AppManagerImpl* __pAppManagerImpl;
755
756         friend class _AppManagerImpl;
757 }; // AppManager
758
759 }} // Tizen::App
760
761 #endif // _FAPP_APP_MANAGER_H_
762