3
votes

i have follow the instruction in this page http://cordova.apache.org/docs/en/3.1.0/cordova_splashscreen_splashscreen.md.html#Splashscreen to test out a splashscreen , it require me to add in this following code to the config , but following is not a valid CML, therefore when i build i got error on it.

<preference name="splashscreen", "splash" />
<preference name="splashScreenDelay", 10000 />

I also try to change the preference name to a valid XML as below, it build successful with out error, but once after build the following preference is also remove from the config.XML automatically

<preference name="splashscreen", value="splash" />
<preference name="splashScreenDelay", value="10000" />

Is that source of sample , so that I can follow it to get my splash screen works

4

4 Answers

3
votes

When I install using the CLI the feature looks like this:

<feature name="SplashScreen">
  <param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" />
</feature>

The documentation says:

<feature name="SplashScreen">
  <param name="android-package" value="org.apache.cordova.SplashScreen" />
</feature>

I used this combination and it worked:

<preference name="splashscreen" value="splash" />
<preference name="splashScreenDelay" value="10000" />

<feature name="SplashScreen">
   <param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" />
</feature>
3
votes

For future reference, the answers above are old. Cordova 4.0 has native support for splash screens, this example from the config.xml should make it clear:

<platform name="android">
    <!-- you can use any density that exists in the Android project -->
    <splash src="res/screen/android/splash-land-hdpi.png" density="land-hdpi"/>
    <splash src="res/screen/android/splash-land-ldpi.png" density="land-ldpi"/>
    <splash src="res/screen/android/splash-land-mdpi.png" density="land-mdpi"/>
    <splash src="res/screen/android/splash-land-xhdpi.png" density="land-xhdpi"/>

    <splash src="res/screen/android/splash-port-hdpi.png" density="port-hdpi"/>
    <splash src="res/screen/android/splash-port-ldpi.png" density="port-ldpi"/>
    <splash src="res/screen/android/splash-port-mdpi.png" density="port-mdpi"/>
    <splash src="res/screen/android/splash-port-xhdpi.png" density="port-xhdpi"/>
</platform>

<platform name="ios">
    <!-- images are determined by width and height. The following are supported -->
    <splash src="res/screen/ios/Default~iphone.png" width="320" height="480"/>
    <splash src="res/screen/ios/Default@2x~iphone.png" width="640" height="960"/>
    <splash src="res/screen/ios/Default-Portrait~ipad.png" width="768" height="1024"/>
    <splash src="res/screen/ios/Default-Portrait@2x~ipad.png" width="1536" height="2048"/>
    <splash src="res/screen/ios/Default-Landscape~ipad.png" width="1024" height="768"/>
    <splash src="res/screen/ios/Default-Landscape@2x~ipad.png" width="2048" height="1536"/>
    <splash src="res/screen/ios/Default-568h@2x~iphone.png" width="640" height="1136"/>
    <splash src="res/screen/ios/Default-667h.png" width="750" height="1334"/>
    <splash src="res/screen/ios/Default-736h.png" width="1242" height="2208"/>
    <splash src="res/screen/ios/Default-Landscape-736h.png" width="2208" height="1242"/>
</platform>
2
votes

It should be:

<preference name="splashscreen" value="splash" />
<preference name="splashScreenDelay" value="10000" />

The phonegap documentation is often quite dodgy...

0
votes

you can simply use like

<preference name="AutoHideSplashScreen" value="true" />
<preference name="SplashScreenDelay" value="5000" />

AutoHideSplashScreen is allow you to change splash delay time.its defauly TRUE.