*/
int app_control_send_launch_request_with_timeout(app_control_h app_control, unsigned int timeout, app_control_reply_cb callback, void *user_data);
+/**
+ * @brief Sends the launch request with setting timeout asynchronously.
+ *
+ * @details This is the extension of @ref app_control_send_launch_request_async() API. \n
+ * The operation is mandatory information for the launch request. \n
+ * If the operation is not specified, #APP_CONTROL_OPERATION_DEFAULT is used by default.
+ * If the operation is #APP_CONTROL_OPERATION_DEFAULT, the application ID is mandatory to explicitly launch the application. \n
+ * It can set receiving timeout using @a timeout parameter.
+ * @details After the callee application is initialized or the launch request is delivered to the running application successfully, the result callback function will be invoked.
+ * @since_tizen 9.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/appmanager.launch
+ * @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 the @ref CAPI_EVENT_MODULE Module.
+ * @remarks 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 the app_control_set_app_id() must be sent.
+ *
+ * @param[in] app_control The app_control handle
+ * @param[in] timeout The timeout in milliseconds, the timeout range is 5000 to 30000
+ * @param[in] result_cb The callback function to be called when the result is delivered
+ * @param[in] reply_cb The callback function to be called when the reply is delivered
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #APP_CONTROL_ERROR_APP_NOT_FOUND The application to run the given launch request is not found
+ * @retval #APP_CONTROL_ERROR_LAUNCH_REJECTED The application cannot be launched in current context
+ * @retval #APP_CONTROL_ERROR_LAUNCH_FAILED Failed to launch the application
+ * @retval #APP_CONTROL_ERROR_TIMED_OUT Failed due to timeout. The application that handles @a app_control may be busy. the timeout interval is set by @a timeout parameter.
+ * @post If the launch request is sent for the result, the result will come back through the app_control_reply_cb() from the callee application. Additional replies may be delivered if app_control_enable_app_started_result_event() was called.
+ * @see app_control_result_cb()
+ * @see app_control_reply_to_launch_request()
+ * @see app_control_reply_cb()
+ * @see app_control_enable_app_started_result_event()
+ */
+int app_control_send_launch_request_async_with_timeout(app_control_h app_control, unsigned int timeout, app_control_result_cb result_cb, app_control_reply_cb reply_cb, void* user_data);
+
/**
* @brief Called when the default application information is delivered.
* @remarks The @a appid MUST NOT be released by the application.
return APP_CONTROL_ERROR_NONE;
}
+EXPORT int app_control_send_launch_request_async_with_timeout(
+ app_control_h app_control, unsigned int timeout,
+ app_control_result_cb result_cb, app_control_reply_cb reply_cb,
+ void* user_data) {
+ if (app_control == nullptr || result_cb == nullptr) {
+ _E("Invalid parameter");
+ return APP_CONTROL_ERROR_INVALID_PARAMETER;
+ }
+
+ try {
+ auto* handle = reinterpret_cast<AppControl*>(app_control);
+ timeout = GetAppControlTimeout(timeout);
+ _I("timeout: %ums", timeout);
+ handle->SetSocketTimeout(timeout);
+ auto request_context = std::make_shared<RequestContext>(
+ std::shared_ptr<AppControl>(new AppControl(*handle)),
+ result_cb, reply_cb, user_data);
+ auto* broker = AppControlBroker::GetInst();
+ broker->SendLaunchRequest(handle, request_context);
+ } catch (Exception& e) {
+ return e.GetErrorCode();
+ }
+
+ return APP_CONTROL_ERROR_NONE;
+}
+
EXPORT int app_control_foreach_default_application(
app_control_default_application_cb callback, void* user_data) {
if (callback == nullptr) {