user3686272
user3686272

Reputation: 31

splashscreen while loading application in android cordova app

We are building a Cordova application and it loads the resources after splash screen. Is there any way in Cordova to load the resources while the splash screen is displayed.

Thanks

Upvotes: 3

Views: 1205

Answers (2)

Simon Prickett
Simon Prickett

Reputation: 4148

Yes, what you want to do is disable the splash screen auto dismiss and dismiss it in your own code, say in the "deviceready" callback in your application or at some other point when you know your app has built its view and is ready.

You will want to tell the splash plugin not to auto hide the splash screen, by adding this to your config.xml and/or setting the splash delay in there to a very long time:

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

Then in your JS code when deviceready happens, or whenever you are ready, programmatically dismiss your splash:

navigator.splashscreen.hide();

More information on this is available in the splash screen plugin documentation.

Upvotes: 5

salih kallai
salih kallai

Reputation: 879

Add this code in your MainActivity.java file to setup a splashscreen

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.setIntegerProperty("splashscreen",R.drawable.splash);
    super.loadUrl(Config.getStartUrl(),2000);
}

Upvotes: 0

Related Questions