Apache Cordova splash screens not showing in Android

后端 未结 9 1413
一生所求
一生所求 2020-12-05 10:24

I am running Apache Cordova 3.6.3-0.2.13. And I try to get the splash screens working. I have followed the documentation on http://cordova.apache.org/docs/en/3.6.0/config_re

相关标签:
9条回答
  • 2020-12-05 10:46

    Splashscreen integration:

    Android

    1. Add the Splashscreen images to folders like below:

      root/res/drawable-land-hdpi/screen.png
      root/res/drawable-land-ldpi/screen.png
      root/res/drawable-land-mdpi/screen.png
      root/res/drawable-land-xdpi/screen.png
      
      root/res/drawable-port-hdpi/screen.png
      root/res/drawable-port-ldpi/screen.png
      root/res/drawable-port-mdpi/screen.png
      root/res/drawable-port-xdpi/screen.png
      
    2. Add splash Screen plugin to android project. (git : git://git.apache.org/cordova-plugin-splashscreen.git)

      src/org/apache/cordova/splashscreen/SplashScreen.java
      
    3. Add plugin javascript file in assets/www/js/lib/android/plugins/cordova-plugin-splashscreen/www/ (git : https://github.com/apache/cordova-plugin-splashscreen/blob/master/www/splashscreen.js)

    4. Add plugin entery in cordova_plugins.js

      {
          "file": "plugins/cordova-plugin-splashscreen/www/splashscreen.js",
          "id": "cordova-plugin-splashscreen.SplashScreen",
          "clobbers": [
              "navigator.splashscreen"
          ]
      },
      
      
      "cordova-plugin-splashscreen": "3.1.0",..   
      
    5. Add following code in config.xml

      <preference name="SplashScreen"         value="screen"/>
      <preference name="SplashScreenDelay"    value="5000" />
      <feature name="SplashScreen">
          <param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" />
          <param name="onload" value="true" />
      </feature>
      
    6. now build the android project.

    0 讨论(0)
  • 2020-12-05 10:46

    I'd faced same issue and I've fixed it by using following configuration :-

    install splash screen plugin

    cordova plugin add cordova-plugin-splashscreen
    

    Next we need to add following preference in config.xml,

    <preference name="SplashScreenDelay" value="3000" />
    <preference name="SplashMaintainAspectRatio" value="true" />
    

    Add the Splashscreen images to folders like below

    <platform name="android">
        <splash qualifier="land-hdpi" src="res/screen/android/splash-land-hdpi.png" />
        <splash qualifier="land-ldpi" src="res/screen/android/splash-land-ldpi.png" />
        <splash qualifier="land-mdpi" src="res/screen/android/splash-land-mdpi.png" />
        <splash qualifier="land-xhdpi" src="res/screen/android/splash-land-xhdpi.png" />
        <splash qualifier="land-xxhdpi" src="res/screen/android/splash-land-xxhdpi.png" />
        <splash qualifier="land-xxxhdpi" src="res/screen/android/splash-land-xxxhdpi.png" />
        <splash qualifier="port-hdpi" src="res/screen/android/splash-port-hdpi.png" />
        <splash qualifier="port-ldpi" src="res/screen/android/splash-port-ldpi.png" />
        <splash qualifier="port-mdpi" src="res/screen/android/splash-port-mdpi.png" />
        <splash qualifier="port-xhdpi" src="res/screen/android/splash-port-xhdpi.png" />
        <splash qualifier="port-xxhdpi" src="res/screen/android/splash-port-xxhdpi.png" />
        <splash qualifier="port-xxxhdpi" src="res/screen/android/splash-port-xxxhdpi.png" />
    </platform>
    

    land-ldpi is not a density but a qualifier

    Therefore the correct each splash tag as below:

    <splash qualifier="land-ldpi" src="res/screen/android/splash-land-ldpi.png" />
    

    After above configuration, below step is very important,

    <platform name="android">
       <preference name="SplashScreen" value="screen" />
    </platform>
    
    0 讨论(0)
  • 2020-12-05 10:49

    Just had this problem myself. Change this

    <preference name="SplashScreen" value="splash"/>
    

    to

    <preference name="SplashScreen" value="screen"/>
    

    This fixed it.

    source: http://forum.ionicframework.com/t/need-help-with-displaying-splash-screen-on-android-cordova-3-6/10436/12

    0 讨论(0)
提交回复
热议问题