Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Splash Screen not working with Cordova 5.0.0

I can't get the splash screen images to load? It flashes white, then goes black and after a few seconds the app loads. My config.xml is as follows:

I'm building using Cordova 5.0.0 targeting Android. I have ported my app over from PhoneGap where it builds successfully and splash screen works.

config.xml

<platform name="android">
    <splash src="www/images/openingscenehdpi.png" density="hdpi"/>
    <splash src="www/images/openingsceneldpi.png" density="ldpi"/>
    <splash src="www/images/openingscenemdpi.png" density="mdpi"/>
    <splash src="www/images/openingscenexhdpi.png" density="xhdpi"/>                
    <preference name="android-minSdkVersion" value="14"/>
    <preference name="android-targetSdkVersion" value="19"/>
    <preference name="SetFullscreen" value="true"/>
    <preference name="orientation"  value="landscape"/>
</platform>

After reading all the other similar problems I have unsuccessfully tried the following, all resulting in no change to app behaviour:

  1. Only having splash elements inside tags
  2. Adding preference name="SplashScreen" value="screen" inside and outside platform tags
  3. Adding preference name="SplashScreen" value="splash" inside and outside platform tags
  4. Adding files direct into folders found in platforms/android/res
  5. Adding spashscreen javscipt into index.html

I've followed the documentation and tried others advice, now I'm totally stumped..

Can anyone help ?

like image 677
Ben Jones Avatar asked Dec 25 '22 18:12

Ben Jones


1 Answers

Fixed! Documentation is lacking, you must to install the Plugin:

cordova plugin add cordova-plugin-splashscreen

Have a res folder at the root of your project with the files in the correct folders (next to config.xml) and the following in your config.xml:

<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="5000" />
<preference name="SplashMaintainAspectRatio" value="true|false" />
<platform name="android">
        <splash src="res/drawable-hdpi/screen.png" density="hdpi"/>
    <splash src="res/drawable-ldpi/screen.png" density="ldpi"/>
    <splash src="res/drawable-mdpi/screen.png" density="mdpi"/>
    <splash src="res/drawable-xhdpi/screen.png" density="xhdpi"/>
    <splash src="res/drawable-xhdpi/screen.png" density="xxhdpi"/>
    <splash src="res/drawable-xhdpi/screen.png" density="xxxhdpi"/> 
</platform>
like image 122
Ben Jones Avatar answered Dec 30 '22 03:12

Ben Jones