Cordoba, Android, incredibly slow loading

I have a Cordova application working with Cordova CLI 6.4.0. During boot, there is a blank white screen for a solid 4-6 seconds when loading after the splash screen. The same thing happens when you restart the application. No events are fired from the application, either before or inside the platform.ready event. After the search, people seem to have some success on similar issues, they are all concentrated around the splash screen below the configuration parameters, none of the suggestions or ideas have worked.

Update

I seem to have made some progress, and I think I understand more about what is happening here. In another entry here, I added the following lines to my config.xml

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

The behavior now, with these two, is that the splash screen is displayed (for a long time, usually about 9 seconds), then Splash quits and my application loads. Thus, this is no longer a white screen of evil, but a very slow download application, this is my problem.

/ Update

Screensaver β†’ 4-6 seconds blank white screen β†’ Then the application loads and the device works. This happens with SplashScreenDelay = 2000

Or it won’t show the splash screen at all and instead will have a blank white screen for 8-9 seconds before loading the application. This happens with SplashScreenDelay = 0

I have console.logs in my main application designer and on the platform. Already, no fire, until the white screen of doom is resolved and gone.

I tried the following options

 <preference name="SplashScreen" value="screen"/> <preference name="SplashScreenDelay" value="2000" /> 

and

 <preference name="SplashScreenDelay" value="0" /> 

This is very confusing because my application is not really slow ... it's just the loading bits with a blank white screen between the splash page and loading the application before anything else happens. I am open to try out any ideas, since in principle he is not released in this state.

This does not happen at all in iOS, while all the builds and settings are identical, this is a feature of Android. The device I'm running on is the Moto E2.

I use Ionic, and below is a list of plugins included, as it seems to be the most likely culprit at this time. I will need to check everything without specific plugins to see how it works.

 cordova-plugin-console 1.0.5 "Console" cordova-plugin-device 1.1.4 "Device" cordova-plugin-facebook4 1.7.4 "Facebook Connect" cordova-plugin-splashscreen 4.0.1 "Splashscreen" cordova-plugin-statusbar 2.2.1 "StatusBar" cordova-plugin-whitelist 1.3.1 "Whitelist" ionic-plugin-keyboard 2.2.1 "Keyboard" 

And here are my full definitions of badges / splashes.

 <platform name="android"> <allow-intent href="market:*" /> <icon platform="android" src="resources/icon.png" /> <icon platform="android" qualifier="ldpi" src="resources/icons/android/icon-36-ldpi.png" /> <icon platform="android" qualifier="mdpi" src="resources/icons/android/icon-48-mdpi.png" /> <icon platform="android" qualifier="hdpi" src="resources/icons/android/icon-72-hdpi.png" /> <icon platform="android" qualifier="xhdpi" src="resources/icons/android/icon-96-xhdpi.png" /> <icon platform="android" qualifier="xxhdpi" src="resources/icons/android/icon-144-xxhdpi.png" /> <icon platform="android" qualifier="xxxhdpi" src="resources/icons/android/icon-192-xxxhdpi.png" /> <splash platform="android" src="resources/splash.png" /> <splash platform="android" qualifier="ldpi" src="resources/screens/android/screen-ldpi-portrait.png" /> <splash platform="android" qualifier="mdpi" src="resources/screens/android/screen-mdpi-portrait.png" /> <splash platform="android" qualifier="hdpi" src="resources/screens/android/screen-hdpi-portrait.png" /> <splash platform="android" qualifier="xhdpi" src="resources/screens/android/screen-xhdpi-portrait.png" /> </platform> 
+6
source share
4 answers

Found one other SO answer, but I solved with

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

The app still needs to download forever (usually about 9 seconds), but I avoid at least a white screen.

0
source

When you create an apk file, be sure to add the "-prod" command:

 ionic cordova build --release --prod android 

This optimizes performance and reduces boot time from 15 seconds (debug collection) to 3 seconds (build) in our application.

+2
source

I have experienced this with Cordova before. I believe that one way to solve this problem is to first load a blank page and then redirect to the actual page of the application. Could you try a try? (You may need to wait for the deviceready event before redirecting, not sure)

0
source

We can speed up application loading by reducing assets. But if this is not possible, we can improve the user experience (instead of showing a blank screen, we can show a pop-up window until all resources are loaded).

In config.xml set auto splashscreen to false.

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

Create a separate javascript file for application-specific events and merge this file in index.html

in javascript file, Catch DeviceReady. In the DeviceReady event handler, hide the splash screen. See code below.

 var app = { // Application Constructor initialize: function() { document.addEventListener('deviceready', this.onDeviceReady.bind(this), false); //You can register other plugin specific events here and handle them. }, onDeviceReady: function() { navigator.splashscreen.hide(); } } }; app.initialize(); 
0
source

Source: https://habr.com/ru/post/1013486/


All Articles