Tejas
Tejas

Reputation: 928

splash screen issue with android + phonegap

i am working with phonegap+sencha touch application.

I have added a splash screen in android as follow,

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

then i have set Autohidesplashscreen property to false as follow in config.xml,

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

still it hide automatically after some seconds, i want to make splash screen visible for some second as i want.
is there any solution for this ?
any help will be appreciated.
thanks in advance.

Upvotes: 1

Views: 272

Answers (2)

danielfbm
danielfbm

Reputation: 86

Follow these steps and let me know if it works for you:

1) Find/add the following tag to your config.xml file under www folder;

In the config.xml: <preference name="SplashScreenDelay" value="3000">

2) Change the value to a greater number (e.g 10000). Beware that the number is in ms;

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: phonegap local plugin list

Cordova: cordova plugin list

4) If you don't have the plugin, add it by using the following command:

Phonegap: phonegap local add plugin org.apache.cordova.splashscreen

Cordova: cordova add plugin org.apache.cordova.splashscreen

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();
    }

PS: All Terminal commands were tested in MacOSX 10.8 using the terminal, and using Phonegap 3.4. All terminal commands must be executed from withing the application folder

Upvotes: 1

GenieWanted
GenieWanted

Reputation: 4513

In your MainActivity.java, you can set a timer value in your super.loadUrl() method. Like this:

super.loadUrl("file:///android_asset/www/index.html",10000); 

This will show Splashscreen for 10 seconds. You can increase the value as you wish.

Upvotes: 1

Related Questions