Manage the splash screen in a Windows Phone 8 based hybrid application
Choose how to manage the splash screen for Windows Phone 8 during application initialization.
Java APIs for showing and hiding the splash screen
In C#, we can use the methods WL.getInstance().showSplashScreen() and WL.getInstance().hideSplashScreen() to show and hide the splash screen from native code (App.xaml.cs).
For example,
private void InitializePhoneAppliation() { if (phoneApplicationInitialized) return; ........... WL.getinstance().showSplashScreen(); }
Change the default splash image
We can change the default splash image that is in the application root folder and is named SplashScreenImage.jpg.
Disable the splash screen in Windows Phone 8
For Windows Phone 8, we can disable the splash screen either by:
- Edit the native Windows Phone 8 App.xaml.cs/MainPage.xaml.cs file and removing or commenting out the WL.getInstance().showSplashScreen() API call.
- Delete the SplashScreenImage.jpg file in the application root folder.
By default, the MobileFirst JavaScript library auto-hides the splash screen when the application is started. To have a smooth transition from the splash screen to the web view, set the option autoHideSplash to false in the initOptions.js file. Use the WL.App.hideSplashScreen() method to hide the splash screen after all of the page initialization tasks (including loading other JavaScript frameworks) are completed.
Make sure that the application initialization flow does not block the JavaScript call to hide the splash screen. For example, a problem can occur when you set the application to connect to the server on application startup, and you define form-based authentication that waits for the user to enter login credentials. In this case, the application shows a web login form behind the splash screen without a way for the user to interact with it.
If we use the splash screen API offered in Cordova, do not use the MobileFirst splash screen APIs at the same time.
Parent topic: Manage the splash screen