本机应用程序,Alarm API不起作用(Sample Tizen Studio项目)

时间:2019-04-04 17:46:49

标签: tizen tizen-wearable-sdk tizen-native-app

我正在编写一个应用程序,该应用程序的功能是在几秒钟的延迟内激活警报,警报管理器根据日志被激活并设置警报,但是在定义的时间之后什么都没有发生。

假设我做错了事,我尝试从Tizen Studio库运行示例项目,那么在我的Galaxy Watch上运行的该项目也无法运行任何警报。

我在我的应用中使用的代码将警报设置为提前10秒钟:

app_control_h app_control = NULL;
app_control_create(&app_control);
app_control_set_operation(app_control, APP_CONTROL_OPERATION_MAIN);
app_control_set_app_id (app_control, "org.example.pushreceiver");
int alarm_id = 1;
int ret1 = 0;
struct tm date;
ret1 = alarm_get_current_time(&date);
date.tm_sec += 10;
ret1 = alarm_schedule_once_at_date(app_control, &date, &alarm_id);

设置警报时记录:

04-04 19:37:45.015 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __alarm_next_duetime_once(155) > Final due_time = 1554399495, Thu Apr  4 19:38:15 2019
04-04 19:37:45.303 : Error / WMS ( 3709 : 3709 ) : wms_package_manager.c: _wms_pkg_mgr_cb_watch_app_filter(843) > PKG[org.example.alarm], App[alarm], Version[2.3.2]
04-04 19:37:45.743 : Error / WMS ( 3709 : 3709 ) : wms_package_manager.c: _wms_pkg_mgr_cb_watch_app_filter(843) > PKG[com.samsung.alarm-solis], App[Alarm], Version[1.1.57]
04-04 19:37:45.979 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __find_next_alarm_to_be_scheduled(536) > The duetime of alarm(447736985) is OVER.
04-04 19:37:45.979 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __find_next_alarm_to_be_scheduled(536) > The duetime of alarm(573079649) is OVER.
04-04 19:37:45.979 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __find_next_alarm_to_be_scheduled(536) > The duetime of alarm(783848223) is OVER.
04-04 19:37:45.979 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __find_next_alarm_to_be_scheduled(536) > The duetime of alarm(1694750646) is OVER.
04-04 19:37:45.979 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __find_next_alarm_to_be_scheduled(536) > The duetime of alarm(2142377266) is OVER.

记录何时发生警报:

04-04 19:37:47.143 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __find_next_alarm_to_be_scheduled(536) > The duetime of alarm(447736985) is OVER.
04-04 19:37:47.143 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __find_next_alarm_to_be_scheduled(536) > The duetime of alarm(573079649) is OVER.
04-04 19:37:47.143 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __find_next_alarm_to_be_scheduled(536) > The duetime of alarm(783848223) is OVER.
04-04 19:37:47.143 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __find_next_alarm_to_be_scheduled(536) > The duetime of alarm(1694750646) is OVER.
04-04 19:37:47.143 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __find_next_alarm_to_be_scheduled(536) > The duetime of alarm(2142377266) is OVER.
04-04 19:37:47.151 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __alarm_next_duetime_once(155) > Final due_time = 1554399482, Thu Apr  4 19:38:02 2019
04-04 19:37:51.851 : Warning / ALARM_MANAGER ( 5012 : 5012 ) : alarm-lib.c: alarmmgr_add_alarm_appsvc_with_localtime(874) > start(4-4-2019, 19:37:61), end(0-0-0), repeat(0), interval(0), type(0)
04-04 19:37:51.919 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __alarm_next_duetime_once(208) > Final due_time = 1554399481, Thu Apr  4 19:38:01 2019
04-04 19:37:51.943 : Warning / ALARM_MANAGER ( 5012 : 5012 ) : alarm-lib.c: __alarmmgr_init_appsvc(737) > alarm was already initialized.
04-04 19:38:01.091 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager.c: __alarm_expired(1976) > Unable to run app svc
04-04 19:38:01.095 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __find_next_alarm_to_be_scheduled(536) > The duetime of alarm(447736985) is OVER.
04-04 19:38:01.095 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __find_next_alarm_to_be_scheduled(536) > The duetime of alarm(573079649) is OVER.
04-04 19:38:01.095 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __find_next_alarm_to_be_scheduled(536) > The duetime of alarm(783848223) is OVER.
04-04 19:38:01.095 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __find_next_alarm_to_be_scheduled(536) > The duetime of alarm(1694750646) is OVER.
04-04 19:38:01.095 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __find_next_alarm_to_be_scheduled(536) > The duetime of alarm(2142377266) is OVER.
04-04 19:38:02.015 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __find_next_alarm_to_be_scheduled(536) > The duetime of alarm(447736985) is OVER.
04-04 19:38:02.015 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __find_next_alarm_to_be_scheduled(536) > The duetime of alarm(573079649) is OVER.
04-04 19:38:02.015 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __find_next_alarm_to_be_scheduled(536) > The duetime of alarm(783848223) is OVER.
04-04 19:38:02.015 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __find_next_alarm_to_be_scheduled(536) > The duetime of alarm(1694750646) is OVER.
04-04 19:38:02.015 : Warning / ALARM_MANAGER ( 2669 : 2669 ) : alarm-manager-schedule.c: __find_next_alarm_to_be_scheduled(536) > The duetime of alarm(2142377266) is OVER.
04-04 19:38:02.031 : Warning / ALARM_MANAGER ( 2900 : 2900 ) : alarm-lib.c: __handle_expiry_method_call(221) > [alarm-lib] Call expired callback
04-04 19:38:02.031 : Info / PUSHD ( 2900 : 2900 ) : polling.c: _alarm_connection_lifetime_cb(930) > epoch_start[1554399482]
04-04 19:38:02.031 : Error / PUSHD ( 2900 : 2900 ) : spp.c: _clear_alarm(465) > No alarm to clear
04-04 19:38:02.031 : Error / PUSHD ( 2900 : 2900 ) : spp.c: _clear_alarm(465) > No alarm to clear
04-04 19:38:02.043 : Info / PUSHD ( 2900 : 2900 ) : polling.c: polling_stop_alarm(1027) > epoch_start[1554399482]
04-04 19:38:02.043 : Info / PUSHD ( 2900 : 2900 ) : polling.c: _clear_alarm(969) > epoch_start[1554399482]

即使对于Tizen Studio示例项目,我也完全无法使用警报API,因为现在我已经尝试将项目API版本从4.0更改为2.3.2,但没有任何效果。 有没有人将正常工作的警报本机项目作为示例?

1 个答案:

答案 0 :(得分:1)

您的代码看起来还不错。我使用自己的远程应用程序检查了您的代码,并重现了您的方案。问题是您的应用程序可能没有“ http://tizen.org/privilege/appmanager.launch”特权。

请检查来自CYNARA安全框架的日志:

sdb dlog AMD_CYNARA_CORE:V

E/AMD_CYNARA_CORE( 2492): amd_cynara_core.c: __cynara_simple_checker(258) > cynara denied (http://tizen.org/privilege/appmanager.launch|(null)|(null)|(null))

当我向应用程序添加提到的特权时,您的代码运行良好。请检查您的应用。