Phonegap - screensaver for Android application

Can someone please tell me how I can add a splash screen to my HTML5 Phonegap based Android app. I just want it to display for 5 seconds at boot time. Also - can someone tell me what size the splash screen should be.

+80
android eclipse cordova
Nov 16 '11 at 18:36
source share
6 answers

To have a splash screen in the Android PhoneGap application, you need to put your splash.png file in res/drawable-ldpi , res/drawable-mdpi , res/drawable-hdpi , res/drawable-xhdpi . If these catalogs are low, medium, high and extra large dots per inch. You will need to resize splash.png (the file name is important here) for each directory, or Android will expand it for you.

The dimensions 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 that extends DroidGap, you need to add one line and change another. First add:

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

this line should be displayed under super.onCreate , but before super.loadUrl . You will then need to change your loadUrl method to pause for 5 seconds before loading the main page. It will look like this:

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

That should do it for you.

I recently made some updates on how SplashScreen works on PhoneGap Android. The main application now loads while the splash screen is displayed. This is a big improvement over the previous screen blocking gap. Learn more about the changes to my blog .

+176
Nov 16 '11 at 18:57
source share

The telephone documentation (Apache Cordova) has enough information about the screen saver and different resolutions for Android and iOS in one place.

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

+6
Dec 14 '12 at 8:20
source share

In my Phonegap application, the Android version, the Eclipse debugger throws tantrums if you install a splash screen or even a download dialog before calling loadUrl.

Both will work in a real application installed on the device, but they will break your debugging. Therefore, I put them behind loadUrl, where they cannot do any harm and still show themselves well in front of the application 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); ... }... 
+3
Mar 05 2018-12-15T00:
source share

I am also facing this problem on android phone .. but now I got a 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. 

Change the main java file in the src folder in the 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); } } 
+3
Jul 22 '13 at 6:55
source share

This is likely to satisfy your needs. It allows you to configure and add all the relevant config.xml settings, images and pop-ups to a nice intuitive interface.

I recommend downloading the file and installing it manually. The web installer is not working.

http://aj-software.com/configap/index.html

0
Aug 26 '13 at 10:06 on
source share

Using Cordova> = 3.6 and creating the application using the Cordova command line interface, you can 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 programmatically display / hide the splash screen.

See the Cordoba documentation for more information.

0
Aug 28 '15 at 12:55
source share



All Articles