Search code examples
javascriptandroidhtmlcordovasmartphone

Put icon before html5 app shows


Possible Duplicate:
phonegap - splash screen for Android app

I have an application built in Html5 and wrapped in PhoneGap for Android

Before app shows in SmartPhone has a black screen

instead of the black screen I want to put an icon.

how can I do it?

If there is a way to do it in JS and not in PhoneGap-it is better.


Solution

  • You're talking about splash screens. Phonegap has splash screen support and it's easy to implement.

    first of all, you add splashscreen plugin:

    <plugin name="SplashScreen" value="org.apache.cordova.SplashScreen"/>
    

    Then in onCreate method of your main java file(the one that extends DroidGap), you add this line:

    super.setIntegerProperty("splashscreen", R.drawable.splash);
    

    Then in javascript deviceready event, you can hide it:

    navigator.splashscreen.hide();
    

    See API Docs