score:176

Accepted answer

in order to have a splash screen in a phonegap android application you need to put your splash.png file into res/drawable-ldpi, res/drawable-mdpi, res/drawable-hdpi, res/drawable-xhdpi. where those directories represent low, medium, high and extra large dots per inch. you'll need to resize you splash.png (the file name is important here) for each directory or android will stretch it for you.

the sizes of each image should be:

  • xlarge (xhdpi): at least 960 x 720
  • large (hdpi): at least 640 x 480
  • medium (mdpi): at least 470 x 320
  • small (ldpi): at least 426 x 320

then in your main java class, the one that extends droidgap, you'll need to add one line and modify another. first add:

super.setintegerproperty("splashscreen", r.drawable.splash);

this line should show up under super.oncreate but before super.loadurl. then you'll need to modify your loadurl method to pause for 5 seconds before loading up the main page. it would look like this:

super.loadurl("file:///android_asset/www/index.html", 5000);

that should do it for you.

i've recently made some updates to how the splashscreen works on phonegap android. the main app now loads while the splash screen is being shown. this is a big improvement over the previous blocking splash screen call. read more about the changes on my blog.

score:0

this will probably meet your needs. it lets you customise and add all the relevant config.xml setting, images and splashscreens in a nice intuitive interface.

i recommend downloading the file and installing manually. the web based air installer doesn't seem to work.

https://aj-software.com/apps/configap.html

score:0

using cordova >= 3.6, and building your app with the cordova command-line interface, it's possible to configure the splash screen from the config.xml file. this is an example for android:

<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>
<preference name="splashscreendelay" value="10000" />

there is also a dedicated plugin to show/hide the splash screen programmatically.

see the cordova documentation for more information.

score:3

in my phonegap app, android version, eclipse debugger throws tantrums if you set the splash screen or even the 'loading' dialog before calling loadurl.

both will work in the actual app installed on a device, but they will break your debugging. so i've put them behind loadurl, where they can do no harm and still show well before the app itself.

public class app extends droidgap {
/** called when the activity is first created. */
@override
public void oncreate(bundle savedinstancestate) {
    super.oncreate(savedinstancestate);
    super.loadurl("file:///android_asset/www/index.html",5000);
    super.setstringproperty("loadingdialog", "starting your app...");
    super.setintegerproperty("splashscreen", r.drawable.splash);
    ...
}...

score:3

i have also face this issue in phonegap android, but now i got solution.

super.setintegerproperty("splashscreen", r.drawable.splash);(find image under drawable folder named splash,so put splash.png under drawable folder)
super.loadurl("file:///android_asset/www/index.html",15000);(splash screen will show 15 sec.

please edit your main java file under src folder in your project directory:

public class radiobiafra extends droidgap
{
    @override
    public void oncreate(bundle savedinstancestate)
    {
         super.oncreate(savedinstancestate);
     
         super.setintegerproperty("splashscreen", r.drawable.splash);
         super.loadurl("file:///android_asset/www/index.html",15000);
     }
}

score:6

phonegap (apache cordova) documentation has enough details about the splash screen and different resolutions for both android and ios at one place.

http://docs.phonegap.com/en/2.2.0/cordova_splashscreen_splashscreen.md.html


Related Query

More Query from same tag