PhoneGap Tutorial 2 Splash Screens and Icons

Welcome to the next in our series of PhoneGap tutorials “PhoneGap Tutorial 2 Splash Screens and Icons”

In this tutorial we are going to go through some simple steps to create a fairly effective logo and splash screen, also the configuration in PhoneGap to get this to work.

Adding a logo, splashscreen and icons to your app makes it look a lot more professional and is definitely worth doing.  If you find this tutorial useful or have any questions please share and leave comments below.

You should allow 1-2 hours to complete this tutorial.

NOTE: The source code for all our tutorials is available on public repositories via BitBucket and Git. The source code for this repository can be downloaded via a git shell or terminal (Linux) using the below command

Pre-Requisites

You must have followed the installation of Phonegap steps and the “Create our base Application” and “Test our base Application” from the PhoneGap Tutorial 1 (Part 1).

This creates a basic hello world app from the windows PhoneGap developer app and the only other thing it does is move your config.xml file into the ‘www’ directory for ease of build using Adobe PhoneGap build.

The only difference from the steps are you should name your application “Super Splash” and give it an ID of “com.gothailand.supersplash” in Step 3 of “Create our base application”

If you have any issues please leave a comment below.

In Scope

  • The creation of the required PhoneGap icon image using microsoft paint
  • The creation of icons and splash screens using the utility at http://pgicons.abiro.com/
  • The configuration of config.xml to use the images correctly including plugin upgrades
  • The generation of an Android debug application to test the splash screen

Note: Splash screens can’t be tested using the PhoneGap developer app so we will create a debug app for Android that we can test on.  This is not a release app, if you need a full release app with certificates and the ability to test on Apple devices that will also require certificates then you need to follow all the steps in the first part of Tutorial 1.

Create a simple icon logo using Microsoft Paint

In this part of the tutorial we will create a basic but effective “Super Splash” logo.

  1. Open Microsoft Paint and modify the properties of the image to be 512×512 pixels with the background to be black and a white foreground
        

  2. Fill the background with the black colour by selecting and right clicking the mouse.
  3. Create 2 large ‘S’s (Broadway Font and Size 72) and place them near each other

  4. Complete the words with (Broadway Font Size 36) and arrange so they look correct

  5. Create a thunderflash using the below tool and fill with yellow colour

  6. Centre the image and save as a .png file (icon.png) (I have created an ‘imagegen’ directory where I am going to store my newly created icon.png file)

Generate the splash screens and icons for your application

  1. Open up the URL http://pgicons.abiro.com/
  2. Configure all the settings as below and upload your new icon.png file

    The first set of checkboxes ensure we generate new iOS images and Android images and also the landscape versions for tablet devices.
    We don’t want to upload a splash screen as we will use our icon on a black background (the background colour #000000 is selected)
    We don’t want to morph as that will distort our image, and we need to select ‘App icon overlay’ to use our icon image
    An 80% aspect ratio is fine for us.
    Now select Generate images.
    You need to download the images zip file to your applications ‘www’ directory.
  3. Now we need to rename ‘www/res’ to ‘www/res_old’ and extract the zip file into the current ‘www’ directory, the files and directory structure should look like below.


    The zip file contained an ‘archive’ directory, this has the original icon.png we uploaded and also icons sized for the Play and Apple stores.
    It also placed a default icon and splash in our ‘www’ directory these are used by PhoneGap build as default images.
    It also created a new ‘res’ directory for us which contains all the correct image sizes for our new icons and splash screens.

We are now ready to make the modifications to our config .xml to initiate the splash screens.

Edit our config.xml

  1. Firstly we need to replace the 4 platform sections (android, ios, wp8 and windows) with the below code, this will use our newly generated images.
  2. Now we need to update the various plugins and add the splash code.
    COMMENT OUT AS BELOW
    ADD THE BELOW TO THE END OF THE FILE BEFORE THE </widget> TAG
    MODIFY THE SDK VERSION FROM 14 to 16 AS BELOW
    These changes will allow us to use the latest PhoneGap build CLI and correct Android SDK and also one of the latest Splash Screen plugins.  It will also specify the default icon and splash screen files (required) and finally it sets our splash screen display to 5 seconds.

We are now in a position to build our debug app and test it on Android.

Generate an Android debug application to test the splash screen

Note: We will not be using certificates to generate the Android debug app as it does not require it, if you need to generate a Production binary or an .apk binary for Test flight you need to follow the procedures in PhoneGap Tutorial 1 (Part 1).

  1. Firstly zip up your ‘www’ directory as below

  2. Open and sign in to the Adobe PhoneGap build site at https://build.phonegap.com
  3. In the ‘Apps’ menu select ‘+ new app’

  4. At the next screen select ‘Upload a zip file’

  5. select the www.zip file that we created in step 1 and then the zip will be uploaded and you will be presented with the application overview
  6. Your app will now look like the below


    The iOS app has not generated as we have not specified keys but the Android app has generated a debug .apk that we can install on our device.

  7. Follow the steps for “Build and Test Push Notification App” from Phonegap Tutorial 1 Part 2 to share your PhoneGap build appication then download and install it onto your Android device.
  8. When you initially open the app on your Android device you will be asked to confirm a lot of permissions, this is because we have not removed all the intial plugins specified in the app, you can just accept this as we do not use any of the functionality.

 

Testing your release on iOS

iOS is a little more restrictive as we can’t install the .ipa directly onto the device as we can on Android and again you will need a Mac to upload the .ipa to iTunesConnect so you can test it on TestFlight.

I am happy to do this for a small ‘beer money’ donation 🙂 and much cheaper than some Internet sites out there advertise!

If you make a $10 donation to my paypal account I will upload an ipa file to your iTunesConnect account 5 times, you can make a donation safely using the paypal link below, once you have made the payment please email paypal@gothai.land and attach your .ipa file and your iTunesConnect login details, also include the id you made the paypal payment with if it is not the same as the email address you send the .ipa from. All requested uploads will made within 12 hours. If you are uncomfortable handing over your login details I am happy to do a screen share using Skype or Teamviewer to show the .ipa being uploaded and me using your login details (you can change your login details right after the upload) however this will cost 2 upload credits of the 5 you purchase.

A lot of work has gone into this series of tutorials so donations do not hurt the cause of me adding to the series 🙂

If you have any queries around this process please contact me online by using the “Support Agent Online” tab at the bottom of the page.




Many thanks for contributing!

The finished product!

Paul

IT consultant with 20+ years experience specialising in Oracle Database, Oracle Business Intelligence, Web/Mobile development, Application Express development, cloud technology and more

Leave a Reply

Your e-mail address will not be published. Required fields are marked *