语言

Menu
Sites
Language
Check the caller App ID when App is launch by Alarm Manager

Hi All,

I have developed a service app for Samsung Z1.

I want to validate each app control coming to my service app.

I am triggering the service app using Alarm manager at specific interval.

When this service app gets triggered I am calling blow API.

int ret = app_control_get_caller(app_control, &app_id_chars);

But above API is failing. How can I validate that this Application is launched by alarm manager and not by other app.

响应

3 回复
Jeongsu Kim

when you register an alarm, you will get alarm_id. save it.

when you launched by alarm you will get extra data APP_CONTROL_DATA_ALARM_ID
https://developer.tizen.org/dev-guide/2.3.0/org.tizen.native.mobile.apireference/group__CAPI__ALARM__MODULE.html#gaeb586eaac6bcb68ab9b73a9fc4a59b9a

if passed alarm_id is in your saved list, then you can use it. you should remove the alarm_id in your saved list.

if passed alarm_id is not in your saved list, then it may be registerd by others. you can ignore it.

Alex Dem

Hi,
Just one question :what error have you got with 'app_control_get_caller' for this case? I have got 'operation' instead of 'app_id' . Not sure that it is right.
p.s. proposed above way is good and should be enough for your case: inside registered with app_control_foreach_extra_data() CB you will be able to get APP_CONTROL_DATA_ALARM_ID as key and alarm_id as value.
Alexey.

Vikram

as the api description of app_control_cb() below:

If the application is launched from the application launcher or explicitly launched by another application, the passed app_control handle may include only the default operation (APP_CONTROL_OPERATION_DEFAULT) without any data.

Seems we cant get the caller id by app_control_get_caller() if the application is explicitly launched by Alarm.

I am just thinking, is it possible in case of implicitly launched? to get caller id by app_control_get_caller().