언어 설정

Menu
Sites
Language
Alarm is not invoked in the emulator

Hello

i am trying to create an app that fires an alarm at a certain time but it is never fired.

I've added

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

to the config.xml and the following code in .js file:

    var alarm = new tizen.AlarmRelative(30);
    tizen.alarm.add(alarm, "org.tizen.clock");
    console.log("Alarm added with id: " + alarm.id);

I get a correct id but the clock (or other apps) are never shown. The same happens when i try to schedule an AlarmAbsolute.

What am i doing wrong?

thanks in advance and greetings

Cris

Edited by: Discla on 07 7월, 2014

Responses

11 댓글
Marco Buettner
<feature name="http://tizen.org/api/tizen" required="true"/>
<feature name="http://tizen.org/api/alarm" required="true"/>
<feature name="http://tizen.org/api/alarm.read" required="true"/>
<feature name="http://tizen.org/api/alarm.write" required="true"/>

Thats bullshit

Add Alarm privileg ;)

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

 

Discla

Ok, but i also have the privilege for alarm. It does not work.

AVSukhov

Hello,

Try this code:

// Triggers an alarm on a given date/time
 var alarm = new tizen.AlarmAbsolute(new Date(2014, 10, 4, 8, 0));
 var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view");
 tizen.alarm.add(alarm, tizen.application.getCurrentApplication().appInfo.id, appControl);
 console.log("Alarm added with id: " + alarm.id);

If it works, then you specify the wrong id for clock (try "tizen.clock")

Maciej

I am facing a similar issue after moving to the SDK 1.0.0b3. Alarm is not getting added nor triggered when using the emulator. The same code works on the device (Gear 2).

         var appId = tizen.application.getCurrentApplication().appInfo.id;
         var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/default");
         var alarm1 = new tizen.AlarmRelative(value * tizen.alarm.PERIOD_MINUTE);
         tizen.alarm.add(alarm1, appId, appControl);

 

No exception is thrown. Id of the alarm is some random value (for example -1272137444), getRemainingSeconds returns 0, tizen.alarm.getAll() returns 0, so no alarm is scheduled.

 

I have the required priviledges declared (as I said above, this code runs perfectly fine on the device).

Any ideas?

Lee Nguyen

same problem. I think this is a bug of emulator. This issue is critical.

Lee Nguyen

please use "Run as" and then alarm works. if use "debug as" then alarm does work. to test with "Run as", please use alert to show up: var alarm = new tizen.AlarmAbsolute(day); tizen.alarm.add(alarm, APP_ID); alert('ALARM = : ' + tizen.alarm.getAll().length); alert("The alarm will trigger at " + alarm.getNextScheduledDate());

Stefano Accorsi

Same problem here. I had an app fully working with the previous SDK. But now I upgraded the SDK, since Samsung asked me to test it in Gear S too, and now it's not working with the emulator, neighter with Gear2 emulator nor with GearS emulator. When I create the alarm nothing is created, if I access the supposed created object it is totally null. I tried RunAs and DebugAs but nothing change.

The good news is that with my Gear2 device it works but how am I supposed to test the app with the GearS emulator?

Marco Buettner

Functionally is on Gear S the same like on Gear 2 ... You should optimize the UI to the bigger resolution of Gear S.

And dont forget to add on "feature" tab of config.xml to add

screen.size.all, screen.size.normal or screen.size.normal.360.480

Stefano Accorsi

Thank you Marco, precious as always.

Did you know that I added your name in the credits of my app? :D

Prajith Premanandan

I used this code

 var alarm = new tizen.AlarmAbsolute(new Date(2010, 1, 1, 1, 45));
 tizen.alarm.add(alarm, "ServiceA25.TCWRBWS25");
 console.log("Alarm added successfully with id: " + alarm.id);

and in logs i got this

01-23 18:47:04.066 : DEBUG / ALARM_MANAGER ( 3967 : 3967 ) : alarm-lib.c: alarmmgr_add_alarm_appsvc_with_localtime(732) > start(1-2-2010, 01:45:00), end(0-0-0), repeat(0), interval(0), type(0)

 

why date is getting set like this

and a  gear emulator can trigger a alarm???

 

Marco Buettner

Because in JavaScript the month are counted from 0-11

0 = January

11 = December

So u have to use

var alarm = new tizen.AlarmAbsolute(new Date(2010, 1-1, 1, 1, 45));