0

I am building an app with Phonegap, but I can't get the splash screens to work on Android.

The icon however works fine.

Here is my config.xml:

<?xml version='1.0' encoding='utf-8'?>
    <widget id="com.example.app"
            version="1.0.0"
            xmlns="http://www.w3.org/ns/widgets"
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:gap="http://phonegap.com/ns/1.0">

        <name>TestAppName</name>
        <description>
            Test description
        </description>
        <author email="123@asd.com" href="http://example.com">
            Author
        </author>

        <plugin name="cordova-plugin-geolocation" source="npm" spec="~2.4.0" />
        <plugin name="cordova-plugin-globalization" source="npm" spec="~1.0.5" />
        <plugin name="cordova-plugin-network-information" source="npm" spec="~1.3.1" />
        <plugin name="cordova-plugin-splashscreen" source="npm" spec="~4.0.1" />
        <plugin name="cordova-plugin-whitelist" source="npm" spec="~1.3.1" />

        <preference name="permissions" value="none"/>
        <preference name="orientation" value="portrait" />
        <preference name="target-device" value="universal" />
        <preference name="fullscreen" value="true" />
        <preference name="webviewbounce" value="true" />
        <preference name="prerendered-icon" value="true" />
        <preference name="stay-in-webview" value="false" />
        <preference name="ios-statusbarstyle" value="black-opaque" />
        <preference name="detect-data-types" value="false" />
        <preference name="exit-on-suspend" value="false" />
        <preference name="disable-cursor" value="false" />

        <preference name="android-installLocation" value="auto" />
        <preference name="android-minSdkVersion" value="14" />

        <preference name="DisallowOverscroll" value="false" />

        <preference name="ShowSplashScreen" value="true" />
        <preference name="ShowSplashScreenSpinner" value="false" />
        <preference name="SplashScreen" value="screen" />
        <preference name="SplashScreenDelay" value="3001"/>
        <preference name="SplashShowOnlyFirstTime" value="false" />
        <preference name="FadeSplashScreen" value="false"/>

        <content src="index.html" />

        <gap:config-file platform="android" parent="/manifest">
            <supports-screens
                    android:xlargeScreens="true"
                    android:largeScreens="true"
                    android:smallScreens="true" />
            <application android:theme="@android:style/Theme.NoTitleBar" >
                <activity android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
                </activity>
            </application>
        </gap:config-file>

        <platform name="android">
            <icon density="ldpi" src="www/res/icon/android/drawable-ldpi-icon.png" />
            <icon density="mdpi" src="www/res/icon/android/drawable-mdpi-icon.png" />
            <icon density="hdpi" src="www/res/icon/android/drawable-hdpi-icon.png" />
            <icon density="xhdpi" src="www/res/icon/android/drawable-xhdpi-icon.png" />
            <icon density="xxhdpi" src="www/res/icon/android/drawable-xxhdpi-icon.png" />
            <icon density="xxxhdpi" src="www/res/icon/android/drawable-xxxhdpi-icon.png" />

            <splash density="port-mdpi" src="www/res/screen/android/drawable-mdpi/background.9.png" />
            <splash density="port-hdpi" src="www/res/screen/android/drawable-hdpi/background.9.png" />
            <splash density="port-xhdpi" src="www/res/screen/android/drawable-xhdpi/background.9.png" />
            <splash density="port-xxhdpi" src="www/res/screen/android/drawable-xxhdpi/background.9.png" />
            <splash density="port-xxxhdpi" src="www/res/screen/android/drawable-xxxhdpi/background.9.png" />
        </platform>

        <access origin="*" />

        <allow-intent href="http://*/*" />
        <allow-intent href="https://*/*" />
        <allow-intent href="tel:*" />
        <allow-intent href="sms:*" />
        <allow-intent href="mailto:*" />
        <allow-intent href="geo:*" />

        <platform name="android">
            <allow-intent href="market:*" />
        </platform>
    </widget>

When having a generic splash screen, and the image in the root of the project it DOES work

<splash src="splash.png" />

The problem is that when installing the app on an android device, the resolution is not correct.

I generated the screens with: ticons.fokkezb.nl And yes ;) I double checked if the file paths are correct.

Does anyone know how to get the splash screens working? Many thanks.

Faiawuks
  • 81
  • 1
  • 8

1 Answers1

0

Include path of splash screen in your config as

 <splash density="port-ldpi" src="www/res/screen/android/drawable-port-ldpi-screen.png" />
 <splash density="port-mdpi" src="www/res/screen/android/drawable-port-mdpi-screen.png" />
 <splash density="port-hdpi" src="www/res/screen/android/drawable-port-hdpi-screen.png" />
 <splash density="port-xhdpi" src="www/res/screen/android/drawable-port-xhdpi-screen.png" />
 <splash density="port-xxhdpi" src="www/res/screen/android/drawable-port-xxhdpi-screen.png" />
 <splash density="port-xxxhdpi" src="www/res/screen/android/drawable-port-xxxhdpi-screen.png" />

So instead of giving "background.9.png" name to your image. Give "drawable-port-ldpi-screen.png" , "drawable-port-mdpi-screen.png" etc

fatema
  • 211
  • 1
  • 5
  • So, renaming the files. You suggestion is what I had originally. So that does not work for me, before generating them via ticons. – Faiawuks Feb 07 '17 at 09:47
  • No icons you have to generate but rename that generated icons according to their size and then provide their paths in config – fatema Feb 07 '17 at 10:08
  • I'm sorry, as much as I wanted it to succeed, renaming them did no work. Still not splash. – Faiawuks Feb 07 '17 at 10:17