Pregunta

I want to create a splash screen in cordova and at the same time while loading splash screen I want to call web services in background. so is this feasible in cordova ? I am new to cordova.Please let me know if there is any possibilities .Thanks in advance .

¿Fue útil?

Solución

For Android, put your splash screen images under res/drawable folders. To show splash screen add below line before loadUrl, in your ProjectName.java class(the one extending CordovaActivity).

super.setIntegerProperty("splashscreen", R.drawable.splashscreen); //R.drawable.your_image_name

From that point you have two options.

  1. Show splashscreen for fixed amount of time:

    super.loadUrl("file:///android_asset/www/index.html", 3000); //this will show 3sec

  2. Do something in JavaScript then close splash manually, call loadUrl without timeout. You can call below anytime in your JS code to close splashscreen:

    navigator.splashscreen.hide();

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top