Languages

Menu
Sites
Language
Alarm API를 통해 다른 app을 호출하는 경우 사용자데이터 전달방법

안녕하세요!

수고가 많으십니다.

 

Alarm API 사용과 관련하여 문의사항이 있어 글을 남겨 봅니다.

 

1. Alaram API인 alarm_schedule_after_delay 함수를 통해 다른 APP을 호출 하는 경우 사용자데이터 전달 방법은?

app_control_add_extra_data 함수를 이용해서 app_control 구조체에 사용자 데이터를 전달하는 방법을 시도해봤지만,

  callee App의 service_app_control 함수의 파라미터로 전달된 app_control_h 구조체에서 app_control_get_extra_data 함수를 이용해 값을 꺼낼 때,

  APP_CONTROL_ERROR_KEY_NOT_FOUND 값을 리턴합니다.

caller)
ret = app_control_add_extra_data(app_control, ALARM_CALL_TO_MEASURE_HRM, ALARM_HRM_COMMAND);
...
ret = alarm_schedule_after_delay(app_control, HRM_ALARM_DELAY, HRM_ALARM_REMIND, &alarm_id);

callee)
ret = app_control_get_extra_data(app_control, ALARM_CALL_TO_MEASURE_HRM, &command);

 

2. Alaram API인 alarm_schedule_after_delay 함수를 통해 다른 APP을 호출하는 경우, callee app에서 caller app의 application ID를 알 수 있는 방법은?

 - callee App에서 app_control_get_caller를 통해 caller app의 app id를 얻으려고 시도 하였으나 APP_CONTROL_ERROR_INVALID_PARAMETER 값을 리턴하였습니다.

caller)
ret = app_control_set_app_id(app_control, APP_ID);
ret = alarm_schedule_after_delay(app_control, HRM_ALARM_DELAY, HRM_ALARM_REMIND, &alarm_id);

callee)
ret = app_control_get_caller(app_control, &caller_id);

 

감사합니다.

Edited by: 종범 이 on 14 Mar, 2017

Responses

2 Replies
Onur Şahin

In an hybrid app i was calling my service both by tizen.application.launchAppControl and tizen.alarm.add and i realize if launchAppControl was passing appcontrol data as it is while alarm.add was passing it as arrays so i come up with this:

static int get_app_control_data_extra(app_control_h app_control,
    	const char* key, char** value) {
	int ret;
	bool isArray;
	app_control_is_extra_data_array(app_control, key, &isArray);
	if (!isArray) {
		ret = app_control_get_extra_data(app_control, key, value);
	} else {
		char** array;
		int size;
		ret = app_control_get_extra_data_array(app_control, key, &array,
						&size);
		if (ret == 0 && size == 1) {
			*value = array[0];
			return 0;
		} else
			return APP_CONTROL_ERROR_INVALID_DATA_TYPE;
	}
	return ret;
}

 

Not sure if this is what you asking(google translate) but i hope it helps

 

 

종범 이

Thanks for sharing your ideas. : )

 

When I try to use alarm_schedule_after_delay function to call another app I can't pass any data to callee app.

But alarm_schedule_at_date function is okay.

 

Have a great day !