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

Web and WebWorks Development

Reply
Trusted Contributor
WorkHorse
Posts: 100
Registered: ‎01-13-2012
My Device: Simulator - 9800
Accepted Solution

How to Run a Repeated Background Task

I need to have a background process be started as soon as the blackberry is turned on and remain in the background. Here it will repeatedly run a function, say every half hour or so. Is this possible in webworks? I'm very new to this so I'm having trouble doing this part of my app. Any help would be appreciated!

Developer
rorybarnes
Posts: 214
Registered: ‎01-07-2011
My Device: Bold 9900

Re: How to Run a Repeated Background Task

From your description I assume you are working on a smartphone app. If so setup a background listener:

<content src="index.html" >
   <rim:background src="listener.html" runOnStartup="true" />
</content>

 

In that listener.html page you can have function that runs on an interval:

function foo(){
//processing code here
}
setInterval("foo()",1800000);

 

--
Rory (@roryboy)
Click "Accept as Solution" if post solved your original issue. Give like/thumbs up if you feel post is helpful
Developer
eblade
Posts: 161
Registered: ‎02-08-2012
My Device: PlayBook

Re: How to Run a Repeated Background Task

happen to know if this is also available on PlayBook ?

Developer
rorybarnes
Posts: 214
Registered: ‎01-07-2011
My Device: Bold 9900

Re: How to Run a Repeated Background Task

Sadly not. Also won't be available for BB10.

 

--
Rory (@roryboy)
Click "Accept as Solution" if post solved your original issue. Give like/thumbs up if you feel post is helpful
Developer
eblade
Posts: 161
Registered: ‎02-08-2012
My Device: PlayBook

Re: How to Run a Repeated Background Task

well, I guess I won't be attempting to use that then :-S

I've heard something rumored about an upcoming "services api", maybe that'll help.