Tuesday, September 8, 2015

Adding splash screen in an android app built on PhoneGap

After struggling alot to add splash screen, finally I have managed to work. Followed the following steps -

  1. Make sure you have all images for splash screen in your www/res/screen/android folder
  2. Find/add the following tag to your config.xml file under www folder;
    (value is in ms, so please add accordingly)
  3. Make sure you have the Splash screen plugin installed (org.apache.cordova.splashscreen). You can check by going to your folder and executing the following command on terminal:
    phonegap plugin list
  4. If you don't have the plugin, add it by using the following command:
    phonegap add plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen.git
  5. In your JavaScript code you can add the following code to close the splash screen:
    //checks for splashscreen and hides it
    if (navigator && navigator.splashscreen) { navigator.splashscreen.hide(); }