White screen after splashscreen, Ionic2, android device

raju picture raju · Jan 9, 2017 · Viewed 18.3k times · Source

I am currently developing Ionic2 app. I face a problem that after Splash screen, there is a white screen for 6-7 seconds, before app home screen.

I tried some googling but nothing works. My last attempt to solve is

    hideSplashScreen() {
    if(Splashscreen){
      setTimeout(() => {
        Splashscreen.hide();
      },100)
    }
  };//

<preference name="SplashMaintainAspectRatio" value="true"/>
<preference name="FadeSplashScreenDuration" value="300"/>

Please help me in this issue;

EDIT:: My ionic info is

Cordova CLI: 6.4.0 
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.1.17
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.47
ios-deploy version: 1.8.6 
OS: OS X El Capitan
Node Version: v6.3.1
Xcode version: Xcode 7.2 Build version 7C68

Answer

Markus Wagner picture Markus Wagner · Jan 17, 2017

By default, the splash screen is hidden after 3 seconds (see https://github.com/apache/cordova-plugin-splashscreen#configxml). But it could be that at this moment your app is not ready.

Therefore I add always the following preference to my config.xml:

<preference name="AutoHideSplashScreen" value="false"/>

Instead, I hide it manually, as soon as the app is ready:

this.platform.ready().then(() => {
    Splashscreen.hide();
});

This is working on iOS as well as on Android.