5

Using Phonegap (3.1.0), Phonegap Build and the Splashscreen plugin I am trying to prevent the splash screen from auto hiding. I will then hide the splash screen from within the JavaScript once the screen has fully loaded.

Currently the splash screen always autohides as soon as the app begins to load the JavaScript, my config.xml is as per below. Primarily I am having this issue on Android 2.2, although I have not looked at iOS yet which I also need to support.

<?xml version="1.0" encoding="UTF-8"?>

<widget xmlns     = "http://www.w3.org/ns/widgets"
        xmlns:gap = "http://phonegap.com/ns/1.0"
        id        = "com.savvy.mobile.Faversham"
        version   = "1.0.0">

    <gap:platform name="android" />
    <gap:platform name="ios" />

    <preference name="phonegap-version" value="3.1.0" />
    <preference name="splash-screen-duration" value="500000" />

    <!-- Default splash -->
    <gap:splash src="splash.png" />

    <gap:plugin name="org.apache.cordova.splashscreen" />  
</widget>
Andy Polhill
  • 6,858
  • 2
  • 24
  • 20
  • what's in your `function onDeviceReady()`? Does it run before or after the splashscreen gets hidden? – benka Nov 26 '13 at 15:14
  • There is quite a lot going on at onDeviceReady, but I'm not sure which happens first. I may remove all of the onDeviceReady code and just see wether the splash screen stays up, which I assume it should. – Andy Polhill Nov 27 '13 at 08:00
  • I have removed any onDeviceReady functionality in the hope that the splash screen would just stay on, however it doesn't, any ideas? – Andy Polhill Nov 27 '13 at 10:52
  • actually the way i sorted it was with the use of `Java` in my `mainActivity` and not through `cordova`. One thing you should try is to add `navigator.splashscreen.show();` as the first thing in `onDeviceReady()` and set up a `setTimeout` with `navigator.splashscreen.hide();` – benka Nov 27 '13 at 10:56
  • Here is my solution: http://stackoverflow.com/a/20407634/158651 – Bart Dec 05 '13 at 18:22

2 Answers2

11

It turned out that "splash-screen-duration" became "SplashScreenDelay" in phonegap 3.1.0.

Change this

<preference name="splash-screen-duration" value="500000" />

to

<preference name="SplashScreenDelay" value="500000" />

As documented here on phonegap community. It would be really helpful if the Phonegap Build documentation was updated accordingly.

Andy Polhill
  • 6,858
  • 2
  • 24
  • 20
3

I had the same issue almost similar but a bit different :

i had SplashScreenDelay set up correctly so that was fine but u also need to add

<preference name="auto-hide-splash-screen" value="false" />

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

at the start i was only setting up auto-hide-splash-screen and it didnt work , but i guess this was for older versions of phonegap so if that didnt work try adding AutoHideSplashScreen then hopefully it will work .

Ashqar
  • 51
  • 5