Steps to know the version of the application in PhoneGap

Posted By : Akhil Dhiman | 22-Sep-2014
Here I will show you how one can get his application version and shown into a div.
 
Plugin to use:
I used plugin named Cordova AppVersion you can use the following link to check the plugin at Github

https://github.com/mclear/NFC_Ring_Control/tree/master/plugins/uk.co.whiteoctober.cordova.AppVersion

 
To add this plugin in your project follow the following procedure -
 
Download the zip file from the above link.
Using terminal go in your project directory, from inside your cordova project you have to enter the following command
 
cordova plugin add {path to downloaded plugin}
 
Now I will show you how to use this plugin. Below is the code to implement this plugin
var version_name = "";
 document.addEventListener("deviceready", function(){
 	cordova.getAppVersion(function (version) {
          version_name = version;
          $('span#appVersion').html("Version:"+version);
    });
 }, false);
 
In device ready event the code to get version of app is written. It will get the version of App from config.xml and we can shown into any Place.
 
Thanks

About Author

Author Image
Akhil Dhiman

Akhil is an iPhone and Android application developer with experience in PhoneGap and Swift(Native iOS). Akhil has good experience working with JavaScript, jQuery and Underscore as well.

Request for Proposal

Name is required

Comment is required

Sending message..