简体   繁体   中英

IONIC 2 and the Splash screen long time

I Developed many apps using ionic 2 and I had rough times with the splash screen. The splash screen takes a lot of time to disappear, I know this depends on the number of the plugins and the time each take to respond. So the problem is how can I delete the waiting of the splash screen or at least reduce it to only one second. Is there any kind of memory management configuration to add to the app so that it doesn't have to restart each time you open the app? I am open to more ideas if you have any.

Thank you

You need to use right CLI for that. Use below one:

debug mode: This CLI supports AOT

ionic cordova run android --prod --device

release mode:

ionic cordova build android --prod --release

You can see http://ionicframework.com/docs/cli/cordova/build/

Build with option --prod. Note that it's longer than 1 second. Depends on hardware, app...

There's some things you can do to lower the time it takes the app to fully load so the splash screen goes off early.

As said by Nguyen building an app with --prod flag ( ionic cordova build android --prod ) can help you. When building in production ionic do some additional steps like optimizing js, minifying css, minifying js and aot (ahead of time) architecture.

These can also be used with a normal building in case you want to test something in development mode, using flags like --minifyjs , --minifycss , --optimizejs , --aot .

Another thing you can do is using enableProdMode() so when angular builds it'll turn off some checkings and assertions from the framework. To do this in your app.ts file inside app folder do

import { enableProdMode } from '@angular/core';

enableProdMode();

Hope this helps you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM