Languages

Menu
Sites
Language
Open native app using Alarm in a determinated time

Hi, 

I'm developing  a native app that needs to use the Alarm API to open itself at a determined time. I saw an example in Tizen web applications, the ExercisePlanner, available with SDK samples that does this, and I want to do that too, but using my native app.

This is the code I'm using:

app_control_create(&app_control1);
app_control_set_operation(app_control1, APP_CONTROL_OPERATION_MAIN);
app_control_set_app_id (app_control1, "org.tizen.alarmsample");

struct tm date;
int alarmId = 0;

alarm_get_current_time(&date);
date.tm_mon +=1;
date.tm_year += 1900;
date.tm_min += 1;

alarm_schedule_at_date(app_control1, &date, 0, &alarmId);

 

According with some logs, this code creates an alarm properly but, at the passed time, my app it's not called. It's ignoring it. Using the alarm_schedule_after_delay function, it works properly, since it uses only a delay to open the called app, not a date.

Is there anything wrong with the code? How may I solve this?

 

Regards.

 

 

Edited by: Amanda Brito on 13 Oct, 2014

Responses

5 Replies
Sanjeev BA

I assume what you want to do is to launch your app at a specific time.

Here is one way to do it.

Make two applications as part of your application package.

1. Create a service application (app that runs in the background)

    For more info (Tizen Mobile Native App Programming > Programming Guide > Application Framework: Controlling Your Application > Service Applications

2. Main application (this is the application to be launched at specific time)

3. Create an app control request as you have done already in the Service application.

4. Set the service application to launch at boot using the manifest.

        <service-application appid="org.tizen.test" auto-restart="true" on-boot="true" .... type="capp">

5. Install the application package that contains (1) and (2).
 

colin Rao

Did you check the actually date value after you set as your code,

alarm_get_current_time(&date);
date.tm_mon +=1;
date.tm_year += 1900;
date.tm_min += 1;

this section code seems strange, suggest only add a few minutes from the currest system time, as change to below and retest.

alarm_get_current_time(&date);
date.tm_min += 3; //after three minutes, the alarm will be triggered

 

Elenin Boris

> Make two applications as part of your application package.

How do I do that?

Elenin Boris

https://developer.tizen.org/dev-guide/web/2.3.0/org.tizen.mobile.web.appprogramming/html/app_dev_process/multiple_project_dev_package.htm

Palitsyna

Hello,

try to use Service Application. Here you can find more information about it: 

Developer Guide: https://developer.tizen.org/development/guides/native-application/application-framework/service-application

API Refference: https://developer.tizen.org/dev-guide/2.3.0/org.tizen.native.mobile.apireference/group__CAPI__SERVICE__APP__MODULE.html

Or use Help in Tizen IDE: Help -> Help Contents -> Service Applications