2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
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 #ifndef __TIZEN_APPFW_APP_CONTROL_H__
19 #define __TIZEN_APPFW_APP_CONTROL_H__
32 * @addtogroup CAPI_APP_CONTROL_MODULE
37 typedef struct _bundle_t bundle;
38 typedef unsigned char bundle_raw;
41 * @brief App Control handle.
42 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
44 typedef struct app_control_s* app_control_h;
48 * @brief Enumeration for App Control Error.
49 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
53 APP_CONTROL_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
54 APP_CONTROL_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
55 APP_CONTROL_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
56 APP_CONTROL_ERROR_APP_NOT_FOUND = TIZEN_ERROR_APPLICATION | 0x21, /**< The application is not found */
57 APP_CONTROL_ERROR_KEY_NOT_FOUND = TIZEN_ERROR_KEY_NOT_AVAILABLE, /**< Specified key is not found */
58 APP_CONTROL_ERROR_KEY_REJECTED = TIZEN_ERROR_KEY_REJECTED, /**< Key is not available */
59 APP_CONTROL_ERROR_INVALID_DATA_TYPE = TIZEN_ERROR_APPLICATION | 0x22, /**< Invalid data type */
60 APP_CONTROL_ERROR_LAUNCH_REJECTED = TIZEN_ERROR_APPLICATION | 0x23, /**< The application cannot be launched now*/
61 APP_CONTROL_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
62 APP_CONTROL_ERROR_LAUNCH_FAILED = TIZEN_ERROR_APPLICATION | 0x24, /**< Internal launch error */
63 APP_CONTROL_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< Time out */
64 APP_CONTROL_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR /**< IO error */
65 } app_control_error_e;
69 * @brief Enumeration for App Control Result.
70 * @see app_control_enable_app_started_result_event()
71 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
75 APP_CONTROL_RESULT_APP_STARTED = 1, /**< Callee application launched actually (Since 2.4) */
76 APP_CONTROL_RESULT_SUCCEEDED = 0, /**< Operation succeeded */
77 APP_CONTROL_RESULT_FAILED = -1, /**< Operation failed by the callee */
78 APP_CONTROL_RESULT_CANCELED = -2, /**< Operation canceled by the platform */
79 } app_control_result_e;
82 * @brief Enumeration for App Control Launch Mode.
86 APP_CONTROL_LAUNCH_MODE_SINGLE = 0, /**< Prefer to launch an application as single mode */
87 APP_CONTROL_LAUNCH_MODE_GROUP, /**< Prefer to launch an application as group mode */
88 } app_control_launch_mode_e;
91 * @brief Definition for the app_control operation: An explicit launch for a homescreen application.
92 * @details Input: Nothing\n
94 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
96 #define APP_CONTROL_OPERATION_MAIN "http://tizen.org/appcontrol/operation/main"
100 * @brief Definition for the app_control operation: An explicit launch for an application that excludes a homescreen application.
101 * @details Input: Nothing\n
103 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
105 #define APP_CONTROL_OPERATION_DEFAULT "http://tizen.org/appcontrol/operation/default"
109 * @brief Definition for the app_control operation: Provides an editable access to the given data.
110 * @details Input: It depends on application scenario/configuration.\n
111 * Output: It depends on application scenario/configuration.\n
112 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
114 #define APP_CONTROL_OPERATION_EDIT "http://tizen.org/appcontrol/operation/edit"
118 * @brief Definition for the app_control operation: Displays the data.
119 * @details Input: URI is usually used to inform the path to show. In some cases, some other data in Extra can be used (e.g., VIEW operation for viewing Contact, Calendar data).\n
121 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
123 #define APP_CONTROL_OPERATION_VIEW "http://tizen.org/appcontrol/operation/view"
127 * @brief Definition for the app_control operation: Picks items.
128 * @details Input: It depends on application scenario/configuration.\n
129 * Output: APP_CONTROL_DATA_SELECTED in Extra\n
130 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
132 #define APP_CONTROL_OPERATION_PICK "http://tizen.org/appcontrol/operation/pick"
136 * @brief Definition for the app_control operation: Creates contents.
137 * @details Input: It depends on application scenario/configuration.\n
138 * Output: APP_CONTROL_DATA_SELECTED in Extra\n
139 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
141 #define APP_CONTROL_OPERATION_CREATE_CONTENT "http://tizen.org/appcontrol/operation/create_content"
145 * @brief Definition for the app_control operation: Performs a call to someone.
146 * @details Input: URI is the number to be dialed. This is mandatory field.\n
148 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
150 * @privilege %http://tizen.org/privilege/call
151 * @remarks When you request this operation, you must declare this privilege.
153 #define APP_CONTROL_OPERATION_CALL "http://tizen.org/appcontrol/operation/call"
157 * @brief Definition for the app_control operation: Delivers some data to someone else.
158 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
159 * @deprecated Deprecated since 2.4. Use #APP_CONTROL_OPERATION_SHARE instead.
161 #define APP_CONTROL_OPERATION_SEND "http://tizen.org/appcontrol/operation/send"
165 * @brief Definition for the app_control operation: Delivers text data to someone else.
166 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
167 * @deprecated Deprecated since 2.4. Use #APP_CONTROL_OPERATION_SHARE_TEXT instead.
169 #define APP_CONTROL_OPERATION_SEND_TEXT "http://tizen.org/appcontrol/operation/send_text"
173 * @brief Definition for the app_control operation: Shares an item with someone else.
174 * @details Input: URI is usually used to inform the path to share. In some cases, some other data in Extra can be used (e.g., SHARE operation for sharing Contact data, SHARE operation for sharing an item through Message, Email applications).\n
176 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
178 #define APP_CONTROL_OPERATION_SHARE "http://tizen.org/appcontrol/operation/share"
182 * @brief Definition for the app_control operation: Shares multiple items with someone else.
183 * @details Input: APP_CONTROL_DATA_PATH in Extra is usually used to inform the data to share. In some cases, some other data in Extra can be used (e.g., MULTI_SHARE opeation for sharing Contact data).\n
185 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
187 #define APP_CONTROL_OPERATION_MULTI_SHARE "http://tizen.org/appcontrol/operation/multi_share"
191 * @brief Definition for the app_control operation: Shares text data with someone else.
192 * @details Input: APP_CONTROL_DATA_TEXT in Extra is the text to share\n
194 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
196 #define APP_CONTROL_OPERATION_SHARE_TEXT "http://tizen.org/appcontrol/operation/share_text"
200 * @brief Definition for the app_control operation: Dials a number. This shows a UI with the number to be dialed, allowing the user to explicitly initiate the call.
201 * @details Input: URI is the number to be dialed. If empty, show a UI without number.\n
203 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
205 #define APP_CONTROL_OPERATION_DIAL "http://tizen.org/appcontrol/operation/dial"
209 * @brief Definition for the app_control operation: Performs a search.
210 * @details Input: APP_CONTROL_DATA_TEXT in Extra is the text to search for. If empty, show a search UI.\n
212 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
214 #define APP_CONTROL_OPERATION_SEARCH "http://tizen.org/appcontrol/operation/search"
218 * @brief Definition for the app_control operation: Downloads items.
219 * @details Input: It depends on application scenario/configuration.\n
220 * Output: It depends on application scenario/configuration.\n
221 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
223 * @privilege %http://tizen.org/privilege/download (Since 2.4)
224 * @remarks When you request this operation, you must declare this privilege. (Since 2.4)
226 #define APP_CONTROL_OPERATION_DOWNLOAD "http://tizen.org/appcontrol/operation/download"
230 * @brief Definition for the app_control operation: Prints contents.
231 * @details Input: It depends on application scenario/configuration.\n
232 * Output: It depends on application scenario/configuration.\n
233 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
235 #define APP_CONTROL_OPERATION_PRINT "http://tizen.org/appcontrol/operation/print"
238 * @brief Definition for the app_control operation: Composes a message.
239 * @details Input: It depends on application scenario/configuration.\n
241 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
243 #define APP_CONTROL_OPERATION_COMPOSE "http://tizen.org/appcontrol/operation/compose"
246 * @brief Definition for the app_control operation: Can be launched by interested System-Event.
247 * @details Input : URI and extras data defined in Event module.\n
250 * @remarks This operation is for handling event from the platform. This operation can not be requested via app_control_send_launch_request().
251 * @remarks Refer to Launch-On-Event section of Event module.
253 #define APP_CONTROL_OPERATION_LAUNCH_ON_EVENT "http://tizen.org/appcontrol/operation/launch_on_event"
256 * @brief Definition for the app_control operation: Adds an item.
257 * @details Input: It depends on application scenario/configuration.\n
258 * Output: It depends on application scenario/configuration.\n
261 #define APP_CONTROL_OPERATION_ADD "http://tizen.org/appcontrol/operation/add"
264 * @brief Definition for the app_control operation: Captures images by camera applications.
265 * @details Input: Nothing\n
266 * Output: APP_CONTROL_DATA_SELECTED in Extra\n
269 #define APP_CONTROL_OPERATION_IMAGE_CAPTURE "http://tizen.org/appcontrol/operation/image_capture"
272 * @brief Definition for the app_control operation: Captures videos by camera applications.
273 * @details Input: Nothing\n
274 * Output: APP_CONTROL_DATA_SELECTED in Extra\n
277 #define APP_CONTROL_OPERATION_VIDEO_CAPTURE "http://tizen.org/appcontrol/operation/video_capture"
280 * @brief Definition for the app_control operation: Shows settings to enable Bluetooth.
281 * @details Input: Nothing\n
285 #define APP_CONTROL_OPERATION_SETTING_BT_ENABLE "http://tizen.org/appcontrol/operation/setting/bt_enable"
288 * @brief Definition for the app_control operation: Shows settings to configure Bluetooth visibility.
289 * @details Input: Nothing\n
293 #define APP_CONTROL_OPERATION_SETTING_BT_VISIBILITY "http://tizen.org/appcontrol/operation/setting/bt_visibility"
296 * @brief Definition for the app_control operation: Shows settings to allow configuration of current location sources.
297 * @details Input: Nothing\n
301 #define APP_CONTROL_OPERATION_SETTING_LOCATION "http://tizen.org/appcontrol/operation/setting/location"
304 * @brief Definition for the app_control operation: Shows NFC settings.
305 * @details Input: Nothing\n
309 #define APP_CONTROL_OPERATION_SETTING_NFC "http://tizen.org/appcontrol/operation/setting/nfc"
312 * @brief Definition for the app_control operation: Shows system settings.
313 * @details Input: Nothing\n
317 #define APP_CONTROL_OPERATION_SETTING "http://tizen.org/appcontrol/operation/setting"
320 * @brief Definition for the app_control operation: Shows settings to allow configuration of Wi-Fi.
321 * @details Input: Nothing\n
325 #define APP_CONTROL_OPERATION_SETTING_WIFI "http://tizen.org/appcontrol/operation/setting/wifi"
328 * @brief Definition for app_control data: Subject
329 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
331 #define APP_CONTROL_DATA_SUBJECT "http://tizen.org/appcontrol/data/subject"
335 * @brief Definition for app_control data: Recipients
336 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
338 #define APP_CONTROL_DATA_TO "http://tizen.org/appcontrol/data/to"
342 * @brief Definition for app_control data: E-mail addresses that should be carbon copied
343 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
345 #define APP_CONTROL_DATA_CC "http://tizen.org/appcontrol/data/cc"
349 * @brief Definition for app_control data: E-mail addresses that should be blind carbon copied
350 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
352 #define APP_CONTROL_DATA_BCC "http://tizen.org/appcontrol/data/bcc"
356 * @brief Definition for app_control data: Text
357 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
359 #define APP_CONTROL_DATA_TEXT "http://tizen.org/appcontrol/data/text"
363 * @brief Definition for app_control data: Title
364 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
366 #define APP_CONTROL_DATA_TITLE "http://tizen.org/appcontrol/data/title"
370 * @brief Definition for app_control data: Selected items
371 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
373 #define APP_CONTROL_DATA_SELECTED "http://tizen.org/appcontrol/data/selected"
377 * @brief Definition for app_control data: Paths of items
378 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
379 * @remarks Since Tizen 2.4, if all added paths with this key are under the caller application's data path which can be obtained by calling app_get_data_path() function, those will be shared to the callee application. Framework will grant a temporary permission to the callee application for those files and revoke it when the callee application is terminated. Paths should be regular files. The callee application can just read them.
381 #define APP_CONTROL_DATA_PATH "http://tizen.org/appcontrol/data/path"
385 * @brief Definition for app_control data: Selection mode. ("single" or "multiple")
386 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
388 #define APP_CONTROL_DATA_SELECTION_MODE "http://tizen.org/appcontrol/data/selection_mode"
392 * @brief Definition for app_control data: All-day mode of event ("true" or "false")
395 #define APP_CONTROL_DATA_CALENDAR_ALL_DAY "http://tizen.org/appcontrol/data/calendar/all_day"
399 * @brief Definition for app_control data: Start time of event (format: YYYY-MM-DD HH:MM:SS)
402 #define APP_CONTROL_DATA_CALENDAR_START_TIME "http://tizen.org/appcontrol/data/calendar/start_time"
406 * @brief Definition for app_control data: End time of event (format: YYYY-MM-DD HH:MM:SS)
409 #define APP_CONTROL_DATA_CALENDAR_END_TIME "http://tizen.org/appcontrol/data/calendar/end_time"
413 * @brief Definition for app_control data: E-mail addresses
416 #define APP_CONTROL_DATA_EMAIL "http://tizen.org/appcontrol/data/email"
420 * @brief Definition for app_control data: Phone numbers
423 #define APP_CONTROL_DATA_PHONE "http://tizen.org/appcontrol/data/phone"
427 * @brief Definition for app_control data: URLs
430 #define APP_CONTROL_DATA_URL "http://tizen.org/appcontrol/data/url"
434 * @brief Definition for app_control data: IDs
437 #define APP_CONTROL_DATA_ID "http://tizen.org/appcontrol/data/id"
441 * @brief Definition for app_control data: Type
444 #define APP_CONTROL_DATA_TYPE "http://tizen.org/appcontrol/data/type"
448 * @brief Definition for app_control data: Total count
451 #define APP_CONTROL_DATA_TOTAL_COUNT "http://tizen.org/appcontrol/data/total_count"
455 * @brief Definition for app_control data: Total size (unit : bytes)
458 #define APP_CONTROL_DATA_TOTAL_SIZE "http://tizen.org/appcontrol/data/total_size"
461 * @brief Definition for app_control data: Name
464 #define APP_CONTROL_DATA_NAME "http://tizen.org/appcontrol/data/name"
467 * @brief Called when the reply of the launch request is delivered.
469 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
471 * @remarks The @a request and @a reply must not be deallocated by the application.
473 * @param[in] request The app_control handle of the launch request that has been sent
474 * @param[in] reply The app_control handle in which the results of the callee are contained
475 * @param[in] result The result code of the launch request
476 * @param[in] user_data The user data passed from the callback registration function
477 * @pre When the callee replies to the launch request, this callback will be invoked.
478 * @pre Since 2.4, if #APP_CONTROL_RESULT_APP_STARTED event is enabled,
479 * this callback also will be invoked when the callee app actually launched.
480 * @see app_control_send_launch_request()
481 * @see app_control_reply_to_launch_request()
482 * @see app_control_enable_app_started_result_event()
483 * @see #APP_CONTROL_RESULT_APP_STARTED
485 typedef void (*app_control_reply_cb) (app_control_h request, app_control_h reply, app_control_result_e result, void *user_data);
489 * @brief Called to retrieve the extra data contained in the app_control.
491 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
493 * @remarks The @a key must not be deallocated by the application.
495 * @param[in] app_control The app_control handle
496 * @param[in] key The key of the value contained in the app_control
497 * @param[in] user_data The user data passed from the foreach function
498 * @return @c true to continue with the next iteration of the loop,
499 * otherwise @c false to break out of the loop
500 * @pre app_control_foreach_extra_data() will invoke this callback.
501 * @see app_control_foreach_extra_data()
503 typedef bool (*app_control_extra_data_cb)(app_control_h app_control, const char *key, void *user_data);
507 * @brief Called once for each matched application that can be launched to handle the given app_control request.
509 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
510 * @param[in] app_control The app_control handle
511 * @param[in] package The package name of the application that can handle the launch request of the given app_control
512 * @param[in] user_data The user data passed from the foreach function
513 * @return @c true to continue with the next iteration of the loop,
514 * otherwise @c false to break out of the loop
515 * @pre app_control_foreach_app_matched() will invoke this callback.
516 * @see app_control_foreach_app_matched()
518 typedef bool (*app_control_app_matched_cb)(app_control_h app_control, const char *appid, void *user_data);
521 typedef int (*app_control_host_res_fn)(void *data);
524 * @brief Creates an app_control handle.
526 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
527 * @remarks The @a app_control must be released using app_control_destroy().
528 * @param[out] app_control The app_control handle to be newly created on success
529 * @return @c 0 on success,
530 * otherwise a negative error value
531 * @retval #APP_CONTROL_ERROR_NONE Successful
532 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
533 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
534 * @see app_control_destroy()
536 int app_control_create(app_control_h *app_control);
540 * @brief Destroys the app_control handle and releases all its resources.
542 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
543 * @param[in] app_control The app_control handle
544 * @return @c 0 on success,
545 * otherwise a negative error value
546 * @retval #APP_CONTROL_ERROR_NONE Successful
547 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
548 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
549 * @see app_control_create()
551 int app_control_destroy(app_control_h app_control);
555 * @brief Sets the operation to be performed.
557 * @details The @a operation is the mandatory information for the launch request.
558 * If the operation is not specified, #APP_CONTROL_OPERATION_DEFAULT is used for the launch request.
559 * If the operation is #APP_CONTROL_OPERATION_DEFAULT, the package information is mandatory to explicitly launch the application.
560 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
561 * @param[in] app_control The app_control handle
562 * @param[in] operation The operation to be performed (if the @a operation is @c NULL, it clears the previous value)
563 * @return @c 0 on success,
564 * otherwise a negative error value
565 * @retval #APP_CONTROL_ERROR_NONE Successful
566 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
567 * @see app_control_get_operation()
568 * @see APP_CONTROL_OPERATION_DEFAULT
569 * @see APP_CONTROL_OPERATION_EDIT
570 * @see APP_CONTROL_OPERATION_VIEW
571 * @see APP_CONTROL_OPERATION_PICK
572 * @see APP_CONTROL_OPERATION_CREATE_CONTENT
573 * @see APP_CONTROL_OPERATION_CALL
574 * @see APP_CONTROL_OPERATION_SEND
575 * @see APP_CONTROL_OPERATION_SEND_TEXT
576 * @see APP_CONTROL_OPERATION_DIAL
577 * @see APP_CONTROL_OPERATION_SEARCH
579 int app_control_set_operation(app_control_h app_control, const char *operation);
583 * @brief Gets the operation to be performed.
585 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
586 * @remarks The @a operation must be released using free().
587 * @param[in] app_control The app_control handle
588 * @param[out] operation The operation to be performed
589 * @return @c 0 on success,
590 * otherwise a negative error value
591 * @retval #APP_CONTROL_ERROR_NONE Successful
592 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
593 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
594 * @see app_control_set_operation()
596 int app_control_get_operation(app_control_h app_control, char **operation);
600 * @brief Sets the URI of the data.
602 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
603 * @remarks Since Tizen 2.4, if the parameter 'uri' is started with 'file://' and it is a regular file in this application's data path which can be obtained by calling app_get_data_path() function, it will be shared to the callee application. Framework will grant a temporary permission to the callee application for this file and revoke it when the callee application is terminated. The callee application can just read it.
604 * @param[in] app_control The app_control handle
605 * @param[in] uri The URI of the data this app_control is operating on (if the @a uri is @c NULL, it clears the previous value)
606 * @return @c 0 on success,
607 * otherwise a negative error value
608 * @retval #APP_CONTROL_ERROR_NONE Successful
609 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
610 * @see app_control_get_uri()
612 int app_control_set_uri(app_control_h app_control, const char *uri);
616 * @brief Gets the URI of the data.
618 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
619 * @remarks The @a uri must be released using free().
620 * @param[in] app_control The app_control handle
621 * @param[out] uri The URI of the data this app_control is operating on
622 * @return @c 0 on success,
623 * otherwise a negative error value
624 * @retval #APP_CONTROL_ERROR_NONE Successful
625 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
626 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
627 * @see app_control_set_uri()
629 int app_control_get_uri(app_control_h app_control, char **uri);
633 * @brief Sets the explicit MIME type of the data.
635 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
636 * @param[in] app_control The app_control handle
637 * @param[in] mime The explicit MIME type of the data this app_control is operating on (if the @a mime is @c NULL, it clears the previous value)
638 * @return @c 0 on success,
639 * otherwise a negative error value
640 * @retval #APP_CONTROL_ERROR_NONE Successful
641 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
642 * @see app_control_get_mime()
644 int app_control_set_mime(app_control_h app_control, const char *mime);
648 * @brief Gets the explicit MIME type of the data.
650 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
651 * @remarks The @a uri must be released using free().
652 * @param[in] app_control The app_control handle
653 * @param[out] mime The explicit MIME type of the data this app_control is operating on
654 * @return @c 0 on success,
655 * otherwise a negative error value
656 * @retval #APP_CONTROL_ERROR_NONE Successful
657 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
658 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
659 * @see app_control_set_mime()
661 int app_control_get_mime(app_control_h app_control, char **mime);
665 * @brief Sets the explicit category.
667 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
668 * @param[in] app_control The app_control handle
669 * @param[in] category The explicit category (if the @a category is @c NULL, it clears the previous value)
670 * @return @c 0 on success,
671 * otherwise a negative error value
672 * @retval #APP_CONTROL_ERROR_NONE Successful
673 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
674 * @see app_control_get_category()
676 int app_control_set_category(app_control_h app_control, const char *category);
680 * @brief Gets the explicit category.
682 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
683 * @remarks The @a category must be released using free().
684 * @param[in] app_control The app_control handle
685 * @param[out] category The explicit category
686 * @return @c 0 on success,
687 * otherwise a negative error value
688 * @retval #APP_CONTROL_ERROR_NONE Successful
689 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
690 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
691 * @see app_control_set_category()
693 int app_control_get_category(app_control_h app_control, char **category);
697 * @brief Sets the ID of the application to explicitly launch.
699 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
700 * @param[in] app_control The app_control handle
701 * @param[in] app_id The ID of the application to explicitly launch (if the @a app_id is @c NULL, it clears the previous value)
702 * @return @c 0 on success,
703 * otherwise a negative error value
704 * @retval #APP_CONTROL_ERROR_NONE Successful
705 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
706 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
707 * @see app_control_get_app_id()
709 int app_control_set_app_id(app_control_h app_control, const char *app_id);
713 * @brief Gets the ID of the application to explicitly launch.
715 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
716 * @remarks The @a app_id must be released with free().
717 * @param[in] app_control The app_control handle
718 * @param[out] app_id The ID of the application to explicitly launch
719 * @return @c 0 on success,
720 * otherwise a negative error value
721 * @retval #APP_CONTROL_ERROR_NONE Successful
722 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
723 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
724 * @see app_control_set_app_id()
726 int app_control_get_app_id(app_control_h app_control, char **app_id);
729 * @brief Adds extra data to the app_control.
731 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
732 * @remarks The function replaces any existing value for the given key.
733 * @remarks The function returns #APP_CONTROL_ERROR_INVALID_PARAMETER if @a key or @a value is a zero-length string.
734 * @remarks The function returns #APP_CONTROL_ERROR_KEY_REJECTED if the application tries to use the same key with system-defined key.
735 * @param[in] app_control The app_control handle
736 * @param[in] key The name of the extra data
737 * @param[in] value The value associated with the given key
738 * @return @c 0 on success,
739 * otherwise a negative error value
740 * @retval #APP_CONTROL_ERROR_NONE Successful
741 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
742 * @retval #APP_CONTROL_ERROR_KEY_REJECTED Key not available
743 * @see app_control_add_extra_data_array()
744 * @see app_control_remove_extra_data()
745 * @see app_control_get_extra_data()
747 int app_control_add_extra_data(app_control_h app_control, const char *key, const char *value);
751 * @brief Adds the extra data array to the app_control.
753 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
754 * @remarks The function replaces any existing value for the given key.
755 * @remarks The function returns #APP_CONTROL_ERROR_INVALID_PARAMETER if @a key is a zero-length string.
756 * @remarks The function returns #APP_CONTROL_ERROR_KEY_REJECTED if the application tries to use the same key with system-defined key.
757 * @param[in] app_control The app_control handle
758 * @param[in] key The name of the extra data
759 * @param[in] value The array value associated with the given key
760 * @param[in] length The length of the array
761 * @return @c 0 on success,
762 * otherwise a negative error value
763 * @retval #APP_CONTROL_ERROR_NONE Successful
764 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
765 * @retval #APP_CONTROL_ERROR_KEY_REJECTED Key not available
766 * @see app_control_add_extra_data()
767 * @see app_control_remove_extra_data()
768 * @see app_control_get_extra_data()
770 int app_control_add_extra_data_array(app_control_h app_control, const char *key, const char* value[], int length);
774 * @brief Removes the extra data from the app_control.
776 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
777 * @param[in] app_control The app_control handle
778 * @param[in] key The name of the extra data
779 * @return @c 0 on success,
780 * otherwise a negative error value
781 * @retval #APP_CONTROL_ERROR_NONE Successful
782 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
783 * @retval #APP_CONTROL_ERROR_KEY_NOT_FOUND Specified key not found
784 * @retval #APP_CONTROL_ERROR_KEY_REJECTED Key not available
785 * @see app_control_add_extra_data()
786 * @see app_control_add_extra_data_array()
787 * @see app_control_get_extra_data()
789 int app_control_remove_extra_data(app_control_h app_control, const char *key);
793 * @brief Gets the extra data from the app_control.
795 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
796 * @remarks The @a value must be released using free().
797 * @remarks The function returns #APP_CONTROL_ERROR_INVALID_DATA_TYPE if @a value is of array data type.
798 * @param[in] app_control The app_control handle
799 * @param[in] key The name of the extra data
800 * @param[out] value The value associated with the given key
801 * @return @c 0 on success,
802 * otherwise a negative error value
803 * @retval #APP_CONTROL_ERROR_NONE Successful
804 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
805 * @retval #APP_CONTROL_ERROR_KEY_NOT_FOUND Specified key not found
806 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
807 * @retval #APP_CONTROL_ERROR_INVALID_DATA_TYPE Invalid data type
808 * @retval #APP_CONTROL_ERROR_KEY_REJECTED Key not available
809 * @see app_control_add_extra_data()
810 * @see app_control_add_extra_data_array()
811 * @see app_control_get_extra_data()
812 * @see app_control_remove_extra_data()
813 * @see app_control_foreach_extra_data()
815 int app_control_get_extra_data(app_control_h app_control, const char *key, char **value);
819 * @brief Gets the extra data array from the app_control.
821 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
822 * @remarks The @a value must be released using free().
823 * @remarks The function returns #APP_CONTROL_ERROR_INVALID_DATA_TYPE if @a value is not of array data type.
824 * @param[in] app_control The app_control handle
825 * @param[in] key The name of the extra data
826 * @param[out] value The array value associated with the given key
827 * @param[out] length The length of the array
828 * @return @c 0 on success,
829 * otherwise a negative error value
830 * @retval #APP_CONTROL_ERROR_NONE Successful
831 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
832 * @retval #APP_CONTROL_ERROR_KEY_NOT_FOUND Specified key not found
833 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
834 * @retval #APP_CONTROL_ERROR_INVALID_DATA_TYPE Invalid data type
835 * @retval #APP_CONTROL_ERROR_KEY_REJECTED Key not available
836 * @see app_control_add_extra_data()
837 * @see app_control_add_extra_data_array()
838 * @see app_control_remove_extra_data()
839 * @see app_control_foreach_extra_data()
841 int app_control_get_extra_data_array(app_control_h app_control, const char *key, char ***value, int *length);
845 * @brief Checks whether the extra data associated with the given @a key is of array data type.
847 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
848 * @param[in] app_control The app_control handle
849 * @param[in] key The name of the extra data
850 * @param[out] array If @c true the extra data is of array data type,
852 * @return @c 0 on success,
853 * otherwise a negative error value
854 * @retval #APP_CONTROL_ERROR_NONE Successful
855 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
856 * @see app_control_add_extra_data()
857 * @see app_control_add_extra_data_array()
858 * @see app_control_remove_extra_data()
859 * @see app_control_foreach_extra_data()
861 int app_control_is_extra_data_array(app_control_h app_control, const char *key, bool *array);
865 * @brief Retrieves all extra data contained in app_control.
866 * @details This function calls app_control_extra_data_cb() once for each key-value pair for extra data contained in app_control. \n
867 * If the app_control_extra_data_cb() callback function returns @c false, then iteration will be finished.
869 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
870 * @param[in] app_control The app_control handle
871 * @param[in] callback The iteration callback function
872 * @param[in] user_data The user data to be passed to the callback function
873 * @return @c 0 on success,
874 * otherwise a negative error value
875 * @retval #APP_CONTROL_ERROR_NONE Successful
876 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
877 * @post This function invokes app_control_extra_data_cb().
878 * @see app_control_extra_data_cb()
880 int app_control_foreach_extra_data(app_control_h app_control, app_control_extra_data_cb callback, void *user_data);
884 * @brief Retrieves all applications that can be launched to handle the given app_control request.
886 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
887 * @param[in] app_control The app_control handle
888 * @param[in] callback The iteration callback function
889 * @param[in] user_data The user data to be passed to the callback function
890 * @return @c 0 on success,
891 * otherwise a negative error value
892 * @retval #APP_CONTROL_ERROR_NONE Success
893 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
894 * @post This function invokes app_control_app_matched_cb().
895 * @see app_control_app_matched_cb()
897 int app_control_foreach_app_matched(app_control_h app_control, app_control_app_matched_cb callback, void *user_data);
901 * @brief Sends the launch request.
903 * @details The operation is mandatory information for the launch request. \n
904 * If the operation is not specified, #APP_CONTROL_OPERATION_DEFAULT is used by default.
905 * If the operation is #APP_CONTROL_OPERATION_DEFAULT, the application ID is mandatory to explicitly launch the application.
906 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
908 * @privilege %http://tizen.org/privilege/appmanager.launch
909 * @remarks The function returns #APP_CONTROL_ERROR_LAUNCH_REJECTED if the operation value is #APP_CONTROL_OPERATION_LAUNCH_ON_EVENT which is only for handling the event from the platform or other application, refer to @a Event module.
910 * @remarks Since Tizen 2.4, the launch request of the service application over out of packages is restricted by the platform. Also, implicit launch requests are NOT delivered to service applications since 2.4. To launch a service application, an explicit launch request with application ID given by app_control_set_app_id() MUST be sent.
911 * @param[in] app_control The app_control handle
912 * @param[in] callback The callback function to be called when the reply is delivered
913 * @param[in] user_data The user data to be passed to the callback function
914 * @return @c 0 on success,
915 * otherwise a negative error value
916 * @retval #APP_CONTROL_ERROR_NONE Successful
917 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
918 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
919 * @retval #APP_CONTROL_ERROR_APP_NOT_FOUND The application to run the given launch request is not found
920 * @retval #APP_CONTROL_ERROR_LAUNCH_REJECTED The application cannot be launched in current context
921 * @retval #APP_CONTROL_ERROR_LAUNCH_FAILED Failed to launch the application
922 * @retval #APP_CONTROL_ERROR_TIMED_OUT Failed due to timeout. The application that handles @a app_control may be busy
923 * @retval #APP_CONTROL_ERROR_PERMISSION_DENIED Permission denied
924 * @post If the launch request is sent for the result, the result will come back through app_control_reply_cb() from the callee application. Additional replies may be delivered on app_control_enable_app_started_result_event() called.
925 * @see app_control_reply_to_launch_request()
926 * @see app_control_reply_cb()
927 * @see app_control_enable_app_started_result_event()
929 int app_control_send_launch_request(app_control_h app_control, app_control_reply_cb callback, void *user_data);
933 * @brief Sends the terminate request to the application that is launched by app_control. This API is only effective for some applications that are provided by default for handling platform default app_controls. You are not allowed to terminate other general applications using this API.
935 * @remarks Since Tizen 2.4, this API can be used to terminate sub-applications which were launched as group mode by caller application.
936 * Once callee application is being terminated by this API, other applications which were launched by callee application as group mode will be terminated as well.
938 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
939 * @param[in] app_control The app_control handle
940 * @return @c 0 on success,
941 * otherwise a negative error value
942 * @retval #APP_CONTROL_ERROR_NONE Successful
943 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
944 * @retval #APP_CONTROL_ERROR_PERMISSION_DENIED Permission denied
945 * @see app_control_send_launch_request()
946 * @see app_control_set_launch_mode()
948 int app_control_send_terminate_request(app_control_h app_control);
952 * @brief Replies to the launch request sent by the caller.
953 * @details If the caller application sent the launch request to receive the result, the callee application can return the result back to the caller.
955 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
956 * @remarks The function is not allowed to send reply #APP_CONTROL_RESULT_APP_STARTED as @a result which is reserved for platform developers.
957 * @param[in] reply The app_control handle in which the results of the callee are contained
958 * @param[in] request The app_control handle sent by the caller
959 * @param[in] result The result code of the launch request
960 * @return @c 0 on success,
961 * otherwise a negative error value
962 * @retval #APP_CONTROL_ERROR_NONE Successful
963 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
964 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
965 * @see app_control_send_launch_request()
967 int app_control_reply_to_launch_request(app_control_h reply, app_control_h request, app_control_result_e result);
971 * @brief Creates and returns a copy of the given app_control handle.
973 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
974 * @remarks A newly created app_control should be destroyed by calling app_control_destroy() if it is no longer needed.
976 * @param[out] clone If successful, a newly created app_control handle will be returned
977 * @param[in] app_control The app_control handle
978 * @return @c 0 on success,
979 * otherwise a negative error value
980 * @retval #APP_CONTROL_ERROR_NONE Successful
981 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
982 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
983 * @see app_control_destroy()
985 int app_control_clone(app_control_h *clone, app_control_h app_control);
989 * @brief Gets the application ID of the caller from the launch request.
991 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
992 * @remarks The @a app_control must be the launch request from app_control_cb().
993 * @remarks This function returns #APP_CONTROL_ERROR_INVALID_PARAMETER if the given app_control is not the launch request.
994 * @remarks The @a id must be released using free().
995 * @param[in] app_control The app_control handle from app_control_cb()
996 * @param[out] id The application ID of the caller
997 * @return @a 0 on success,
998 * otherwise a negative error value
999 * @retval #APP_CONTROL_ERROR_NONE Successful
1000 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
1001 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
1003 int app_control_get_caller(app_control_h app_control, char **id);
1007 * @brief Checks whether the caller is requesting a reply from the launch request.
1009 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1010 * @remarks The @a app_control must be the launch request from app_control_cb().
1011 * @remarks This function returns #APP_CONTROL_ERROR_INVALID_PARAMETER if the given app_control is not the launch request.
1012 * @param[in] app_control The app_control handle from app_control_cb()
1013 * @param[out] requested If @c true a reply is requested by the caller,
1014 * otherwise @c false
1015 * @return @c 0 on success,
1016 * otherwise a negative error value
1017 * @retval #APP_CONTROL_ERROR_NONE Successful
1018 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
1019 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
1021 int app_control_is_reply_requested(app_control_h app_control, bool *requested);
1024 * @brief Sets the launch mode of the application.
1026 * @details This function allows callee application to be launched as group or single mode.
1027 * @remarks Although launch_mode were set as #APP_CONTROL_LAUNCH_MODE_GROUP, callee application would be launched as single mode if the manifest file of callee application defined the launch mode as "single".
1028 * This function can just set the preference of caller application to launch an application.
1029 * @remarks Sub-applications which were launched as group mode always have own process.
1032 * @param[in] app_control The app_control handle
1033 * @param[in] launch_mode The launch mode of app
1035 * @return 0 on success, otherwise a negative error value
1036 * @retval #APP_CONTROL_ERROR_NONE Successful
1037 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
1038 * @see app_control_set_launch_mode()
1039 * @see app_control_launch_mode_e
1041 int app_control_set_launch_mode(app_control_h app_control,
1042 app_control_launch_mode_e mode);
1045 * @brief Gets the launch mode of the application.
1048 * @param[in] app_control The app_control handle
1049 * @param[out] launch_mode The launch mode of app
1051 * @return 0 on success, otherwise a negative error value
1052 * @retval #APP_CONTROL_ERROR_NONE Successful
1053 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
1054 * @see app_control_get_launch_mode()
1055 * @see app_control_launch_mode_e
1057 int app_control_get_launch_mode(app_control_h app_control,
1058 app_control_launch_mode_e *mode);
1061 * @brief Enables additional launch result event on launch request.
1063 * @details The function allows to receive #APP_CONTROL_RESULT_APP_STARTED event on\n
1064 * application get launched by app_control.
1065 * @remarks app_control_reply_cb() will be called on APP_CONTROL_RESULT_APP_STARTED event received.
1067 * @param[in] app_control The app_control handle
1068 * @return 0 on success, otherwise a negative error value
1069 * @retval #APP_CONTROL_ERROR_NONE Successful
1070 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
1071 * @see app_control_send_launch_request()
1072 * @see #APP_CONTROL_RESULT_APP_STARTED
1074 int app_control_enable_app_started_result_event(app_control_h app_control);
1083 #endif /* __TIZEN_APPFW_APP_CONTROL_H__ */