04-27-2014 03:10 PM
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?
Solved! Go to Solution.
04-27-2014 04:36 PM
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...
04-28-2014 09:32 AM
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-Deve
I could offer more specific suggestions if you can provide an overview of what your app is actually doing at start up.