0

I've trying with several tutorials to have splascreen worked with at least default screen.png provided by cordova.

i edited the xml in root of my appiclation path (ex: cordova/myapp) to add the 2 lines required to have splashcreen showed as follow:

<?xml version='1.0' encoding='utf-8'?>
<widget id="fr.bacly.baclym" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>baclym</name>
    <description>
Application Mobile du Bacly    </description>
    <author email="philippe.ihuel@bacly.fr" href="http://cordova.io">
        Philippe Ihuel
    </author>
    <content src="index.html" />
    <preference name="Orientation" value="portrait" />
    <plugin name="cordova-plugin-whitelist" version="1" />
    <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">
    <!-- you can use any density that exists in the Android project -->
<!--         <splash src="res/res-land-hdpi/screen.png" density="land-hdpi"/>
        <splash src="res/res-land-ldpi/screen.png" density="land-ldpi"/>
        <splash src="res/res-land-mdpi/screen.png" density="land-mdpi"/>
        <splash src="res/res-land-xhdpi/screen.png" density="land-xhdpi"/>
        <splash src="res/res-port-hdpi/screen.png" density="port-hdpi"/>
        <splash src="res/res-port-ldpi/screen.png" density="port-ldpi"/>
        <splash src="res/res-port-mdpi/screen.png" density="port-mdpi"/>
        <splash src="res/res-port-xhdpi/screen.png" density="port-xhdpi"/> -->
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
        <preference name="SplashScreen" value="screen" />
        <preference name="SplashScreenDelay" value="30000" />    
</widget> 

I run on genymotion with a simulated S4 Android 4.4.2, but it doesnt show anything except a black screen for some times.

Any advice ?

Nightf
  • 61
  • 1
  • 7

2 Answers2

0

there is another way of doing that:

This is your main Activity

package com.example.abc;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
public class MainActivity extends Activity
 {

@Override

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
     this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.splash);

 Thread background = new Thread() {

        public void run() {

      try {       // Thread will sleep for 5 seconds

      sleep(5*1000); // After 5 seconds redirect to another intent
     Intent i=new Intent(getBaseContext(),Splash.class);

startActivity(i);

//Remove activity

       finish();
} 
 catch (Exception e) {}
}
};
// start thread
 background.start();
}

 @Override

 public void onDestroy() {


    super.onDestroy();
      }
     }

This is your Second Activity :

 package com.example.abc;

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

 public class Splash extends CordovaActivity {

 @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        // Set by <content src="index.html" /> in config.xml
        loadUrl(file:///android_asset/www/index.html);
    }

  }

Make launcher mainActivity in manifest file.

  • I'm developping n angularJS an deploing with cordova, so this solution may not satisfy my purpose – Nightf Aug 28 '15 at 14:51
0

I finally manage to have it work following the answer on this post Cordova 3.4 Splashscreen not working

Community
  • 1
  • 1
Nightf
  • 61
  • 1
  • 7