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
Developer
bert2002
Posts: 172
Registered: ‎05-01-2010
My Device: Z10
My Carrier: O2
Accepted Solution

onload not started after device reboot

Hi,

 

is it possible that "onload" in the body section is only executed when the app is actually opened?

What I noticed is when the device is restarted and the app is started after the booting process then I need to open the app before anything is working. Is this as designed?

 

Is there a way to run a javascript function hat will be executed after the app is started after a reboot?

 

Thanks.



----------------------------------------------------------
find my widgets -> http://blackberry.itbert.de
Please use plain text.
Developer
rorybarnes
Posts: 214
Registered: ‎01-07-2011
My Device: Bold 9900
My Carrier: Rogers

Re: onload not started after device reboot

I believe you need to add

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

to your config.xml where the filename is the file you want to have running in the background.

 

More details at:

https://bdsc.webapps.blackberry.com/html5/documentation/ww_developing/rim_background_element_1265316... 

 

Rory

--
Rory (@roryboy)
Click "Accept as Solution" if post solved your original issue. Give like/thumbs up if you feel post is helpful
Please use plain text.
Developer
bert2002
Posts: 172
Registered: ‎05-01-2010
My Device: Z10
My Carrier: O2

Re: onload not started after device reboot

good point. I will give it a try :smileywink: 

 

But is it the same page when you request the application to come to the foreground?



----------------------------------------------------------
find my widgets -> http://blackberry.itbert.de
Please use plain text.
Developer
rorybarnes
Posts: 214
Registered: ‎01-07-2011
My Device: Bold 9900
My Carrier: Rogers

Re: onload not started after device reboot

[ Edited ]

I believe the best practice is to have a separate page that just contains and runs the JS functions you need to run in the background at startup. Less overhead on the system.

 

if you use the same functions on start-up that you use in your app you can just put them all into a JS file and include that on each html page. That way the functions aren't duplicated.

--
Rory (@roryboy)
Click "Accept as Solution" if post solved your original issue. Give like/thumbs up if you feel post is helpful
Please use plain text.