When Windows 8 is released later in 2012, users will expect to be able to launch a Windows 8 Metro app quickly and with little to no lag time once it is clicked on by a mouse or touched by a finger. In the newest post on the Windows 8 app developer blog site, Microsoft gives Metro app creators some tips on how to code their apps to launch quickly for users.
The highly technical blog post talks about the splash screen for Metro apps: Microsoft says:
When users launch an app, they are immediately greeted by the splash screen. Every Metro style app has a splash screen, which consists of a 620x300 image and solid background color. Windows presents the splash screen on your behalf in order to welcome users while your app is activated. The activated event is received by all apps on launch, and gives your app the ability to perform any initialization work needed to present its initial UI. This might include reading basic settings, determining what page to navigate to, and/or identifying whether the app was activated for one of the various contracts.
Once the splash screen goes away, a Metro app must then show off its first window. While developers who work with JavaScript-based apps won"t have anything to worry, apps based on C# apps must bring up the first window via a call to Window.Current.Activate. The blog adds:
Be careful not to delay this operation, as your app will be terminated if a window is not displayed within a reasonable amount of time (~15 seconds). In addition, you’ll want to present a window as fast as possible because unnecessarily keeping the splash screen up can quickly deteriorate the user experience. We recommend that you present a window within 2-3 seconds to ensure that your app will always launch as expected, even on low-end hardware.
The blog goes over over four different ways a Windows 8 Metro app can be launched from start to completion, along with example code for each type of app launch. One is the default app launch, which is shown above with Internet Explorer 10 in Metro. Microsoft says, "In this flow, Windows handles the display and removal of each app’s splash screen. The splash screen is displayed until activation completes and a window is presented, triggering an animated crossfade to the app’s landing page."
The second way is the skeleton app launch, which may be needed for apps that need to load content before they are ready to be used. You can see an example in the Windows 8 Music Metro app above.
The third app launch example on Windows 8 is the extended app launch. This time, the example is the Windows 8 Weather app which may need some additional help, such as connecting to the Internet, to retrieve its information. In that case, Microsoft says an extended launch splash screen may be needed. The blog states:
The extended splash screen is owned entirely by the app and is formatted using the splash screen API. The API provides positioning information that ensures the look and feel of the extended splash screen is visually identical to the splash screen (with the exception of a progress ring or loading details), which unifies the seemingly independent loading operations. While the extended splash screen is up, the app can continue executing tasks needed to paint the landing page. Then, after loading is complete, you can transition from the extended splash screen to the landing page.
Finally, there is the deferred app launch. Microsoft uses the Photo app in Windows 8 as the example for this type of Metro app. The blog states that instead of an extended splash screen, " ... the app defers dismissal of the regular splash screen until asynchronous tasks have been executed. Because apps have limited time to complete this deferral, the deferral pattern should be used sparingly, and mainly to complete simple asynchronous operations like reading app settings before the app is displayed."
Images via Microsoft