语言

Menu
Sites
Language
Alarm

Cannot invoke alarm on either device or emulator.

This is the code:

 var date = new Date(2014, 11, 22, 15, 48);// 22 dec 2014 15:48
    var alarm = new tizen.AlarmAbsolute(date, ["SA&", "SU"]);
    tizen.alarm.add(alarm, "org.tizen.clock")
 

响应

23 回复
Sanjeev BA

Have you provided the following privilege?

<tizen:privilege name="http://tizen.org/privilege/alarm"/>

Ritesh Manek

I did provide the privelage

AVSukhov

Hello,

1. Do you add alarm privilege to config.xml?

2. Are you sure that you have an application with "org.tizen.clock" app id? For example on tizen 2.3 for launch clock app need to use "com.samsung.clock-lite" app id.

Alex Dem

Hi, just fyi:
You could try to look at ExercisePlanner sample web app in IDE which uses alarm.
Alexey.

Ritesh Manek

Even this code does'nt trigger d alarm...

 

var alarm = new tizen.AlarmAbsolute(new Date(2014, 11,22, 15, 34));
     var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view");
     tizen.alarm.add(alarm, tizen.application.getCurrentApplication().appInfo.id, appControl);

 

 

AVSukhov

Hello,

I tested this code:

var now = new Date();
now.setMinutes(now.getMinutes() + 1);
var alarm = new tizen.AlarmAbsolute(now);
tizen.alarm.add(alarm, tizen.application.getCurrentApplication().appInfo.id);

and it works fine.

Ritesh Manek

Thank you,

The code is working properly.What if I want to launch my application when alarm triggers???

AVSukhov

Hello,

I do not understand your question.
The code above is just launches your application when alarm triggers.

Ritesh Manek

I want a particular HTML file to popup when alarm is triggered and not the index file.

AVSukhov

Hello,

You can add AppControl to alarm.add method

f.e. new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/myOperation");

Export appcontrol functionality to your app

f.e. in config.xml

<tizen:app-control>

<src name="myAlarmPage.html"/>

<operation name="http://tizen.org/appcontrol/operation/myOperation" />

<tizen:app-control>

Anusha Sajeendran
Hi, I used the same code to set an alarm in my wearable app, but it is not working. (Tizen 2.3.0). Is there any change in the codings for 2.3.0 ? Please help me
AVSukhov

Hello,

Make sure that you added following privileges to config.xml:

<tizen:privilege name="http://tizen.org/privilege/alarm"/>
<tizen:privilege name="http://tizen.org/privilege/application.launch"/>

 

Anusha Sajeendran

Hi,

I have added those codings in the config.xml file. In addition, I added these following features too..

    <feature name="http://tizen.org/api/tizen" required="true"></feature>
    <feature name="http://tizen.org/api/alarm" required="true"></feature>
    <feature name="http://tizen.org/api/alarm.read" required="true"></feature>
    <feature name="http://tizen.org/api/alarm.write" required="true"></feature>

AVSukhov

Hello,

Features are used for application filtering in the Samsung Apps.

For using specific API you need to add the appropriate privileges.

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

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

Vaishnavi GM

Hello,

Is it possible to display a text when alarm gets triggered in a wearable app, 2.3. If yes please help me.

AVSukhov

Hello,

I do not understand what you mean.
What kind of behavior you want to achieve?

Vaishnavi GM

Hi,

I am trying to create an alarm in a wearable application. When a specific time comes the alarm should trigger and instead of launching application, I need just a text to display.

AVSukhov

Hello,

Alarm API using for scheduling the app launches. 

When you add new alarm to the system you need specify applicationId parameter which determines the application to run when the alarm is triggered. 

But for example you can add alarm with specific AppControl, in which you can provide additional information that may be displayed when your application is launched.

Ritesh Manek

I get an error "Tizen not defined"...when I try to run it on emulator

AVSukhov

Hello,

Emulator or Web Simulator?

Ritesh Manek

web simulator

AVSukhov

Hello,

Not faced with similar problem in Tizen SDK 2.3

Maybe someone will tell the solution.
I can only advise to try reinstall SDK and verify that wrt-plugins-tizen is installed.

Marco Buettner

I had the same problem for long time... Use another workspace should fix the problem.