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

Native Development

Reply
Developer
Posts: 76
Registered: ‎02-08-2013
My Device: z10
My Carrier: rogers
Accepted Solution

App Initialization: when and where?

In a recent BB10 update I noticed that if an app doesn't completely initialize within 5-6 seconds this logs appears:

forensics_logworthy_state: Error attaching 2, No such file or directory, bailing

And the app appears to crash.

 

It took a while to figure out it wasn't the code but how long the code was running - which is the root of my problem. My app has asubstantial amount of initialization work to do, question is when and where is the best place to do this time consuming work?

 

I initialially though I had to let the event loop start and I'd be safe but no, that wasn't the case, crash still happened.

 

Do I have to run this initialization process in another thread? Is it unwise to run this much work in the UI context?

 

Devs, how do you initialize your non-UI app portions?

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: App Initialization: when and where?

I think you've already given yourself your answer but yes run it in another thread.

 

Time consuming processes should be asynchronous and run using one of the threading methods such as QThread or QtConcurrent...

 

http://developer.blackberry.com/native/reference/cascades/qthread.html

 

 

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Highlighted
Retired
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: App Initialization: when and where?

It's a good idea to try and minimize as much as possible the amount of work that needs to be done when your app first launches. Users expect an app to be in a usable state within a two seconds in order to feel snappy.

 

A good general approach is to only do exactly what you need to display the first screen. Use things like ComponentDelegates in QML to prevent the entire application flow from having to be loaded into memory at launch. Defer network calls until the app is already started. Follow the approach outlined here: http://supportforums.blackberry.com/t5/Native-Development-Knowledge/Improving-startup-performance-of...

 

I could offer more specific suggestions if you can provide an overview of what your app is actually doing at start up.

 

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker
Developer
Posts: 76
Registered: ‎02-08-2013
My Device: z10
My Carrier: rogers

Re: App Initialization: when and where?

I was doing image processing and various database queries, offsetting most of this heavy work to a worker thread did the trick. Thanks for the advice.

 

-e