Add the Splash startup page to your Cordova HybridApp, cordovahybridapp

Source: Internet
Author: User

Add the Splash startup page to your Cordova HybridApp, cordovahybridapp

Currently, the latest Cordova 3 or later versions support the startup screen, which is implemented through the cordova plug-in.

Currently, the Splash plug-in supports android, ios, blackberry, and other platforms.


The process of adding a plug-in is as follows:

Add the SplashScreen plug-in

Run the following command in the cordova project directory:

cordova plugin add org.apache.cordova.splashscreen

This command downloads the plug-in code from the plug-in git Library to the plugins directory of the project.


Modify the config. xml configuration file

<Preference name = "SplashScreen" value = "screen"/> <! -- The file name without the suffix png. The default value is screen --> <preference name = "SplashScreenDelay" value = "3000"/> <! -- Display time of Splash. The default value is 3000 ms. --> <feature name = "SplashScreen"> <param name = "android-package" value = "org. apache. cordova. splashscreen. splashScreen "/> </feature>


You can see that the name of the startup image is screen.png. Some default screen.png images are displayed under the project. The cordova logo is displayed. You need to replace these images with your own startup image. You can simply delete the unsupported size image.


Hide the Splash screen after device Initialization is complete

document.addEventListener("deviceready", onDeviceReady, false);  function onDeviceReady() {    navigator.splashscreen.hide();  }  

If the ionic framework is used, add it directly to the. run (['$ ionicPlatform', function ($ ionicPlatform) {...} of the app. js file.
navigator.splashscreen.hide();

You can.


Run your App now and you will see the startup screen.



The cordova folder generated by sencha app build native is incomplete.

Have you referenced the cordova project first?
After creating a project with sencha, switch to the generated project folder and run sencha cordova init com. youname. appname reference.
 

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: info-contact@alibabacloud.com 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.