Lukas
Lukas

Reputation: 1356

PhoneGap Build - Set splash-screen for Android devices

I'm currently trying to set an splash-screen for Android devices in PhoneGap build. I set 4 different screens, but somehow the screens get deformed and lost their aspect ratio. Is there a way to prevent that?

Upvotes: 3

Views: 10130

Answers (4)

DEVARAJ JOHNSON
DEVARAJ JOHNSON

Reputation: 235

we can set this in three ways

  1. through config.xml
  2. through the activity class setting the property
  3. through script

to refer more sample source code sample source code with example for phonegap-build-set-splash-screen

http://getmebyclickme.blogspot.in/2013/10/phonegap-build-set-splash-screen-for.html

Upvotes: 1

Red2678
Red2678

Reputation: 3287

Do'h, missing that the question was about Android, here is the Android section from my config.xml:

<gap:splash src="img/splash/android/ldpi.png" gap:platform="android" gap:density="ldpi" />
<gap:splash src="img/splash/android/mdpi.png" gap:platform="android" gap:density="mdpi" />
<gap:splash src="img/splash/android/hdpi.png" gap:platform="android" gap:density="hdpi" />
<!--<gap:splash src="splash/android/xhdpi.png" gap:platform="android" gap:density="xhdpi" />-->

Yes, Apple is much easier! On Android they go by qualifier called "densities".

To my knowledge PhoneGap Build only supports three of the four right now. ldpi, mdpi, hdpi and NOT xdpi (that is why it is commented out above).

All Android devices will use one of these four sizes, is my understanding. Obtaining perfect aspect ratio across hundreds of different devices may be a little challenging, but with this you at least get close .

Read this, I know it is a lot, but worth the reading: http://developer.android.com/guide/practices/screens_support.html#support

And, the PGB Guidelines: http://build.phonegap.com/docs/config-xml

Upvotes: 3

Red2678
Red2678

Reputation: 3287

This is how I have them my PGB config.xml (your folder structure and file names will vary), this supports most IOS devices I believe. How many launch images do you have?

<gap:splash src="img/splash/ios/Default.png" width="320" height="480" />
<gap:splash src="img/splash/ios/Default_at_2x.png" width="640" height="960" />
<gap:splash src="img/splash/ios/Default_iphone5.png" width="640" height="1136" />
<gap:splash src="img/splash/ios/Default-Landscape.png" width="1024" height="768" />
<gap:splash src="img/splash/ios/Default-Portrait.png" width="768" height="1024" />
<gap:splash src="img/splash/ios/Hi-Rez-Portrait.png" width="1536" height="2008" />
<gap:splash src="img/splash/ios/Hi-Rez-Landscape.png" width="2048" height="1496" />

Apple's guidlines: http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/mobilehig/IconsImages/IconsImages.html

Phonegap Build's guidelines:http://build.phonegap.com/docs/config-xml

Upvotes: 0

Rohit
Rohit

Reputation: 3408

import android.os.Bundle;
   import org.apache.cordova.*;

  public class RemindMeActivity extends DroidGap {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.setIntegerProperty("splashscreen", R.drawable.splash);
    super.loadUrl("file:///android_asset/www/index.html", 10000);


}
}

this will help u to show splash screen using phonegap

Upvotes: 0

Related Questions