Search code examples
cordovaionic3ionic-native

Ionic 3 - How to get application version number?


I am using app-version plugin to get version number. I am trying as below : plugin

this.appVersion.getVersionNumber().then((res)=>{
console.log(res); 
}, (err)=>{
console.log(err); 
});

I am getting error :

class not found

does anyone faced same issue or is there any other way to get version number ?


Solution

  • I was forget to add in device ready event. So finally I added in device event now it is working perfectly in android and ios.

    this.platform.ready().then(()=> {
       this.appVersion.getVersionNumber().then((res)=>{
        console.log(res); 
       }, (err)=>{
        console.log(err); 
       });
    });