Most modern platforms - WindowsStore, WindowsPhone and iOS - allow you to set static Default.jpg (or similar) to entertain your users while launching your application.
Android does not do this - it just launches your application using an Activity marked as MainLauncher.
If your application needs to do some initialization work (as most MvvmCross applications do), then this leaves you the choice of whether you are doing this work in the user interface thread (which then leads to an unresponsive user interface) or you are showing a SplashScreen placeholder, and then initialize in the background thread.
This is what MvvmCross is trying to let you do.
- it provides you with a splashscreen class
- it overrides the
OnCreate splash screen to do minimal work in the UI thread during the OnCreate splash screen (the UI is black during this time, which is horrible) - then it does the main part of init in the threadpool thread - as @CheeseBaron pointed to MvxBaseSplashScreenActivity.cs # L79
The main part of the initialization types is loading, starting services, restoring settings, loading language files, etc. - no need to do in the user interface thread.
If there is any part of the initialization that you need to do in the user interface thread, then it depends on your application to figure out how and when to marshal this work back to the user interface.
However, obviously, in no case should you try to march any long-term work on the user interface stream ... the user interface stream is intended for the user interface, and not for intensive calculation or for any blocking work.
You should strive to maintain responsiveness of the user interface even during startup.
Detailed Note:
The above description covers the “normal launch” of an application, for example. Android homepage.
However, if you dive deeper, this is not the only way to launch the application - it can also be launched from push notifications, from recovery after killing (say “tombstoned” in WP), or from things like broadcasting receivers.
In these situations, the initialization of the MvvmCross application can occur in other ways than described above:
- in the case of starting MvxActivity directly (for example, from push or after restoring after burial), then the whole installation starts in the user interface stream during OnCreate of this action - this is not ideal and this is something I hope that the structure can improve in the future.
- in the case of starting the background service, before the application engineer to determine what needs to be configured when - for example, see Using MvvmCross from the content and action providers
One possibility of an alternative launch route is to subclass the Android Application object - see http://developer.android.com/reference/android/app/Application.html