【发布时间】:2017-06-16 15:48:29
【问题描述】:
在 Samsung gear S3 中,我想开发一个 Tizen 本地服务应用程序,它会持续检查 Web 应用程序是否正在运行,如果 Web 应用程序没有运行则启动它。 连续,我的意思是它可以每分钟检查一次,也可以添加一个事件侦听器(用于应用程序的状态更改)。
我想这样做是因为我的 Web 应用程序会在一段时间后终止(可能是一天左右),但我希望它始终在后台运行。
现在,我可以使用以下代码从服务应用程序启动 Web 应用程序。
app_control_h app_control;
int ret = APP_CONTROL_ERROR_NONE;
ret = app_control_create(&app_control);
if (ret != APP_CONTROL_ERROR_NONE)
dlog_print(DLOG_ERROR, LOG_TAG, "app_control_create() is failed. err = %d", ret);
ret = app_control_set_operation(app_control, APP_CONTROL_OPERATION_VIEW);
if (ret != APP_CONTROL_ERROR_NONE)
dlog_print(DLOG_ERROR, LOG_TAG, "app_control_set_operation() is failed. err = %d", ret);
app_control_set_app_id(app_control, "08CCMUEFHN.ROAMMprompt");
ret = app_control_send_launch_request(app_control, NULL, NULL);
if (ret != APP_CONTROL_ERROR_NONE)
dlog_print(DLOG_ERROR, LOG_TAG, "app_control_send_launch_request() is failed. err = %d", ret);
请帮助我开发代码以不断检查我的 Web 应用程序是否正在运行。
【问题讨论】: