Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
New Contributor
Posts: 6
Registered: ‎05-18-2011
My Device: PlayBook
My Carrier: None

How to set alarm and trigger it even if the application is not running ?

I am developing an alarm clock application in air... how to set alarm using setAlarm method in qnx api and run it in back ground so that even if application is closed the alarm triggers at set time.

 

Sorry for re-posting in developer forums

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: How to set alarm and trigger it even if the application is not running ?

The qnx.system.QNXSystem.setAlarm() method is not used for this purpose.  Its purpose is to let your app get some CPU time even when it is in standby (either because it's not the active app in Paused or Default modes, or because the whole device has entered Standby).

 

There is as yet no documented interface to let an app get launched automatically at a given time.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
New Contributor
Posts: 6
Registered: ‎05-18-2011
My Device: PlayBook
My Carrier: None

Re: How to set alarm and trigger it even if the application is not running ?

[ Edited ]

Thanks for your reply peter Smiley Happy

 

Then with which class and method we can set the alarm ?

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: How to set alarm and trigger it even if the application is not running ?

Not sure if you completely read my answer... "there is as yet no documented interface" to do what you're asking. There simply is no supported way to do it yet.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
New Contributor
Posts: 6
Registered: ‎05-18-2011
My Device: PlayBook
My Carrier: None

Re: How to set alarm and trigger it even if the application is not running ?

  ya peter, but currently I just need to set the alarm and play some sound when the clock ticks the alarm time, while the application is running. I came across some of the application like TalkClock and etc setting the alarm, hence i feel there is something which can be done to set alarm.

 

I am novice please don't mind Smiley Wink

Developer
Posts: 426
Registered: ‎04-10-2011
My Device: Z30

Re: How to set alarm and trigger it even if the application is not running ?

Did you try using a timer that is set to a certain interval to match the required alarm-time?
-----------------------------------------------------------------------------
Check out my apps in the BlackBerry World
Visit my developer blog alopix.net
BBM Channel: C0047B612
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: How to set alarm and trigger it even if the application is not running ?

You need to use the Timer class.
Developer
Posts: 128
Registered: ‎03-18-2011
My Device: PlayBook
My Carrier: verizon

Re: How to set alarm and trigger it even if the application is not running ?

You can try something like this:

 

QNXSystem.system.setAlarm(1000, true);	// sets duration for 1 second and repeat is true
QNXSystem.system.addEventListener(QNXSystemEvent.ALARM, onAlarm);

 

private function onAlarm(event:QNXSystemEvent):void
{
	tf.text = "Count = " + ++count;
	sound.play();
}

 

This works while the app is running and when the app is in standby. When Application Behavior is paused though you won't get sound but the count variable will still increment.