Menu
Sites
Language

Simple alarm set

Function for simple allarm setting with specified alarm delay and repetition period. After application exit alarm open it after set delay time.
//    PRIVILEGE needed to be set in tizen-manifest.xml:
//    http://tizen.org/privilege/alarm.set
//    http://tizen.org/privilege/alarm.get

#include <app.h>
#include <app_alarm.h>

void
set_alarm(int delay, int period) {
	int alarm_id = 0;
	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.tizen.first");

	if(alarm_schedule_after_delay(app_control, delay, period, &alarm_id) == ALARM_ERROR_NONE)
		LOGI("Alarm set");

//	to cancel alarm use:
//	alarm_cancel(alarm_id);
}

Responses

1 Replies
Sunwook Bae

Since 2.4, you don't need to set the operation like below:

    app_control_set_operation(app_control, APP_CONTROL_OPERATION_MAIN);