I made a ionic cordova project but after publishing to android mobile phone. The duration of our program is around 10-20 sec with respec to the mobile phone types.
When I search this problem, people say that it is because of
- Splash Screen duration (Ionic splash screen not loading and Ionic2 performance issue)
- Path problem of any image
- 3rd Party libraries
- External CDN script libraries
- Lazy loading of pages
I try to solve regarding above problems e.g. i removed 3rd party libraries or CDN based scripts and check the all image paths etc..
I think Ionic is a wrong choice for mobile programming.
Is there any solution to decrease the opening duration of my mobile application ?
Thanks
The all other answers are also necessary but I want to add another opinion.
If u use IONIC 3 you can try lazy loading and discard unnecessary 3rd party libraries like awesome or another...
This new feature from Ionic 3 not only makes our code more concise but also avoid the hassle of typing every damn time the same paths in every Class!
Lazy Loading allows us to access Pages wherever we want by only using a string.
In old version, u need to use
import { AboutPage } from '../pages/about/about';
import { ContactPage } from '../pages/contact/contact';
import { HomePage } from '../pages/home/home';
import { TabsPage } from '../pages/tabs/tabs';
@NgModule({
declarations: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage
],
.
.
.
entryComponents: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage
]
})
In Ionic 3 u dont need to import these classes. U can use ionic g page example
Then we see that a @IonicPage
decorator and a module with a same name in the directory.
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { Lazy } from './example';
@NgModule({
declarations: [
Example,
],
imports: [
IonicPageModule.forChild(example),
],
exports: [
Example
]
})
export class ExampleModule {}
This pages or components could not be loaded while starting program.
Add these line to you main.prod.ts file.
import { enableProdMode } from '@angular/core';
enableProdMode();
and then build using this command
ionic cordova build android --prod --release
Ionic is the perfect solution for mobile app development.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 this CLI list here