I have a Cordova app running Cordova CLI 6.4.0. During load, there is a blank white screen for a solid 4-6 seconds on load after the splash screen. This same thing happens during app reload. No events fire from the app, either before or inside platform.ready event. After searching there seems to be some success by people for similar issues, all centered around the splash screen the below config options, none of the suggestions or ideas have worked.
Update
I seem to have made some progress and I think I understand more of what's going on here. Per another post here I added the below lines to my config.xml
<preference name="AutoHideSplashScreen" value="false" />
<preference name="SplashScreenDelay" value="10000"/>
The behavior now, with those two, is that the Splash Screen is displayed (for a long time, usually around 9 seconds), then the Splash goes away and my app loads. So it's no longer a white screen of evil but just a very slow to load app that is my problem.
/Update
Splash Screen -> 4-6 seconds blank white screen -> Then the app loads and deviceReady fires. This happens with SplashScreenDelay=2000
Or it will not show the splash screen at all and instead have 8-9 seconds of the blank white screen before the app loads. This happens with SplashScreenDelay=0
I have console.logs in my main app's constructor and on platform.ready, neither fire until the white screen of doom is resolved and gone away.
I have tried the below options
<preference name="SplashScreen" value="screen"/>
<preference name="SplashScreenDelay" value="2000" />
and
<preference name="SplashScreenDelay" value="0" />
It's very confusing because it's not actually my app that's being slow... it's just the loading bits, with a blank white screen between the splash page and app load before anything else happens. I'm open to trying out any ideas as it's basically un-releasable in this state.
This does not happen at all on iOS, with the build and settings all identical, it's an Android specific issue. The device I am running on is a Moto E2.
I am using Ionic and below is a list of included plugins, as it seems that's the most likely culprit at this time. I will have to test everything out without certain plugins to see how it performs.
cordova-plugin-console 1.0.5 "Console"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-facebook4 1.7.4 "Facebook Connect"
cordova-plugin-splashscreen 4.0.1 "Splashscreen"
cordova-plugin-statusbar 2.2.1 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"
And here's my full icon/splash definitions.
<platform name="android">
<allow-intent href="market:*" />
<icon platform="android" src="resources/icon.png" />
<icon platform="android" qualifier="ldpi" src="resources/icons/android/icon-36-ldpi.png" />
<icon platform="android" qualifier="mdpi" src="resources/icons/android/icon-48-mdpi.png" />
<icon platform="android" qualifier="hdpi" src="resources/icons/android/icon-72-hdpi.png" />
<icon platform="android" qualifier="xhdpi" src="resources/icons/android/icon-96-xhdpi.png" />
<icon platform="android" qualifier="xxhdpi" src="resources/icons/android/icon-144-xxhdpi.png" />
<icon platform="android" qualifier="xxxhdpi" src="resources/icons/android/icon-192-xxxhdpi.png" />
<splash platform="android" src="resources/splash.png" />
<splash platform="android" qualifier="ldpi" src="resources/screens/android/screen-ldpi-portrait.png" />
<splash platform="android" qualifier="mdpi" src="resources/screens/android/screen-mdpi-portrait.png" />
<splash platform="android" qualifier="hdpi" src="resources/screens/android/screen-hdpi-portrait.png" />
<splash platform="android" qualifier="xhdpi" src="resources/screens/android/screen-xhdpi-portrait.png" />
</platform>
Found one some other SO answer, but I have solved with the below
<preference name="AutoHideSplashScreen" value="false" />
<preference name="SplashScreenDelay" value="10000"/>
The app still takes forever to load (usually around 9 seconds), but I avoid the white screen nonsense at least.
When you build the apk-file, be sure to include "--prod" in the command:
ionic cordova build --release --prod android
This optimizes performance and decreases boot-time from 15 seconds (debug build) to 3 seconds (production build) in our app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With