Cordova application to modify the splash screen or icon

Source: Internet
Author: User
Tags time in milliseconds

1) Create a splash screen image or icon

Ionic resources//simultaneous generation of icon and splash

Ionic Resources--icon//Generate icon only

Ionic Resources--splash//Generate Splash Only

If the generated icon/splash is damaged, Cordova build Android will error, the solution is to regenerate or another PS;

2) Add two configuration items to config. ins in the project root directory:

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

<preferencename= "Splashscreendelay" value= "30000"/>

Where the first configuration specifies the file name of the splash screen, and the second setting specifies the time in milliseconds for the splash screen to stay.

3) Add the processing function to the homepage:

document.addEventListener ("deviceready", onDeviceReady, false);
     // Cordova will trigger when loading is complete
     function onDeviceReady () {
          navigator.splashscreen.hide ();

The value of the above configuration item Splashscreendelay is recommended to be as large as possible, such as 20000 (20 seconds). According to my understanding, the Start screen display, the first page is still under normal loading (that is, the program will not wait until the splash screen disappears before starting to load the first page); If the set delay value is too small, such as 3000 (3 seconds), and the first page load needs 5000 (5 seconds), then the screen will be in the black screen state When you set a value that is larger than the first page load time value, the red line of code hides the splash screen in advance.

Cordova application to modify the splash screen or icon

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.