* @brief Resumes the given application.
*
* @param[in] appid The ID of the application
+ * @param[in] instance_id The instance ID of the application
* @param[in] uri The URI of the data
*
* @return EINA_TRUE or EINA_FALSE on failure
*/
-extern Eina_Bool util_launch_app(const char *appid, const char *uri);
+extern Eina_Bool util_launch_app(const char *appid, const char *instance_id,
+ const char *uri);
/**
* @brief Returns absolute path to resource file located in applications directory
appid = info->appid;
ret_if(!appid);
- util_launch_app(appid, info->uri);
+ util_launch_app(appid, info->instance_id, info->uri);
/* layout_hide_with_timer(); */
}
return ret;
}
-Eina_Bool util_launch_app(const char *appid, const char *uri)
+Eina_Bool util_launch_app(const char *appid, const char *instance_id,
+ const char *uri)
{
int ret;
app_control_h service = NULL;
+ app_context_h context = NULL;
if (!appid || strlen(appid) == 0) {
_E("Fail to launch, due to Null appid.");
return EINA_FALSE;
}
+ if (instance_id)
+ app_manager_get_app_context_by_instance_id(appid, instance_id, &context);
+ else
+ app_manager_get_app_context(appid, &context);
+
+ if (context) {
+ _D("Application(%s) is running. Resuming...", appid);
+ ret = app_manager_resume_app(context);
+ app_context_destroy(context);
+ if (ret == APP_MANAGER_ERROR_NONE)
+ return EINA_TRUE;
+ else
+ _E("Failed to resume application(%s)", appid);
+ }
+
+ _D("Application(%s) is not running. Launching...", appid);
ret = app_control_create(&service);
if (ret != APP_CONTROL_ERROR_NONE) {
_E("Failed to create app_control handle");