Languages

Menu
Sites
Language
Service in a Combined Package not starting

Hi, 

I created Combined Package with Native Service and Native UI app, following these steps: https://developer.tizen.org/development/training/native-application/application-development-process#develop

Service:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<manifest xmlns="http://tizen.org/ns/packages" api-version="2.4" package="org.miney.appsaver" version="1.0.0">
<profile name="mobile"/>
<service-application appid="org.miney.appsaver" auto-restart="true" exec="appsaver" multiple="false" nodisplay="true" on-boot="true" taskmanage="false" type="capp">
    <background-category value="sensor"/>
</service-application>
<privileges>
	<privilege>http://tizen.org/privilege/display</privilege>
</privileges>
<feature name="http://tizen.org/feature/screen.size.all">true</feature>

UI App

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<manifest xmlns="http://tizen.org/ns/packages" api-version="2.4" package="org.miney.appsaverui" version="1.0.0">
    <profile name="mobile"/>
    <ui-application appid="org.miney.appsaverui" exec="appsaverui" launch_mode="single" multiple="false" nodisplay="false" taskmanage="true" type="capp">
        <label>appsaverui</label>
        <icon>appsaverui.png</icon>
    </ui-application>
    <feature name="http://tizen.org/feature/screen.size.all">true</feature>
</manifest>

Combined Manifest:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<manifest xmlns="http://tizen.org/ns/packages" api-version="2.4" package="org.miney.appsaverui" version="1.0.0">
    <profile name="mobile"/>
    <ui-application appid="org.miney.appsaverui" exec="appsaverui" launch_mode="single" multiple="false" nodisplay="false" taskmanage="true" type="capp">
        <label>appsaverui</label>
        <icon>appsaverui.png</icon>
    </ui-application>
    <service-application appid="org.miney.appsaver" auto-restart="true" exec="appsaver" multiple="false" nodisplay="true" on-boot="true" taskmanage="false" type="capp">
        <background-category value="sensor"/>
    </service-application>
    <privileges>
        <privilege>http://tizen.org/privilege/display</privilege>
    </privileges>
    <feature name="http://tizen.org/feature/screen.size.all">true</feature>
    <feature name="http://tizen.org/feature/sensor.accelerometer">true</feature>
    <feature name="http://tizen.org/feature/sensor.proximity">true</feature>
</manifest>

 

but only UI app is starting and service not. Separately service was working fine so this is not a service code related bug. Documentation says:

The service or widget application is built and run automatically while the UI application is built and run.

Thanks for your help.

Edited by: Kamil N on 14 Feb, 2017
View Selected Answer

Responses

6 Replies
Mark as answer
Shaswati Saha

I've faced the similar problem even with the older versions. You may try a workaround of this. Use appcontrol to launch the service app. Please use the below code:

app_control_h app_control;
app_control_create(&app_control);
app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
app_control_set_app_id(app_control, "org.example.servicecombined"); //"org.example.servicecombined" is the service app id in my case
app_control_send_launch_request(app_control, NULL, NULL);

app_control_destroy(app_control);

 

Kamil N

Thanks! 

Kamil N

Hi,

Did you know how to run service after device boot up? I found attribute on-boot but it doesn't work.

NoteThis attribute is not supported in Tizen wearable devices. Since Tizen 2.4, this attribute is not supported in all Tizen devices. Because of this, the on-boot attribute used in a lower API version package than 2.4 is ignored in the devices with the Tizen platform version 2.4 and higher.

So there is no possibility to start service on startup?

Yo Shakya

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px 'Eco Sans Mono'}

Using the below code in the manifest file for a project targeted at 2.3 and above devices work for me. I test my code on 2.4 and it seems to be working fine ( == starts automatically after the boot up)

 

<service-application appid="bo" auto-restart="true" exec="bo" multiple="false" nodisplay="true" on-boot="true" taskmanage="false" type="capp">

 

Hope that helps!

Kamil N

Targeting API 2.3 helps. Thanks:)

Yo Shakya

And here is code from my project to start the service: 

static void app_control_result(app_control_h request, app_control_h reply, app_control_result_e result, void* user_data);

static void* gUserData = 0;

void launch_popup_app(const char* appid, int wants_launch_result, 
const char* value_pgkid, const char* value_appid, const char* value_passcode,
bo_cb_launcher_hook hook, void* user_data) { //wants_launch_result = 0: no, 1=yes
    TRACE

	int err = 0;
	app_control_h app_control = NULL;

	gUserData = user_data;

	err = app_control_create(&app_control);
	if(APP_CONTROL_ERROR_NONE != err) {
		ERR("Could not create app control. app_control_create returned error. [%d]", err);
		return;
	}

	err = app_control_set_app_id(app_control, appid);
	if(APP_CONTROL_ERROR_NONE != err) {
		ERR("app_control_set_app_id returned error. [%d]", err);
		return;
	}

	err = app_control_set_operation(app_control, APP_CONTROL_OPERATION_MAIN);
	if(APP_CONTROL_ERROR_NONE != err) {
		ERR("app_control_set_operation returned error. [%d]", err);
		return;
	}

	if(value_pgkid) {
		err = app_control_add_extra_data(app_control, KEY_EXTRA_DATA_PKG_ID, value_pgkid);
		if(APP_CONTROL_ERROR_NONE != err) {
			ERR("app_control_add_extra_data returned error. [%d]", err);
			return;
		}
	}

	if(value_appid) {
		err = app_control_add_extra_data(app_control, KEY_EXTRA_DATA_APP_ID, value_appid);
		if(APP_CONTROL_ERROR_NONE != err) {
			ERR("app_control_set_operation returned error. [%d]", err);
			return;
		}
	}
  
  if(value_passcode) {
		err = app_control_add_extra_data(app_control, KEY_EXTRA_DATA_PASSCODE, value_passcode);
		if(APP_CONTROL_ERROR_NONE != err) {
			ERR("app_control_set_operation returned error. [%d]", err);
			return;
		}
	}

	if(wants_launch_result) {
		err = app_control_send_launch_request(app_control, app_control_result, hook);
	} else {
		err = app_control_send_launch_request(app_control, NULL, NULL);
	}
	if(APP_CONTROL_ERROR_NONE != err) {
		ERR("app_control_send_launch_request returned error. [%d]", err);
		return;
	}

	err = app_control_destroy(app_control);
	if(APP_CONTROL_ERROR_NONE != err) {
		ERR("app_control_send_launch_request returned error. [%d]", err);
		return;
	}
}