user1938653
user1938653

Reputation: 609

How to get the version of the current installed app using Cordova?

I already found AppAvailability plugin which basically checks if a user installed a certain app on his device.

Is there a possibility to the current version of the app, developer name (important) and everything it possibly can? Is this even possible in general?

Upvotes: 3

Views: 4190

Answers (2)

SoEzPz
SoEzPz

Reputation: 15922

Command Line

Also, the version can be found via the command line

$ cordova info

Scroll down until you see Project Setting Files:

 config.xml:
 <?xml version='1.0' encoding='utf-8'?>
 <widget id="com.your.app" version="1.1.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">

Upvotes: 0

kenorb
kenorb

Reputation: 166871

Using AppAvailability plugin it is not possible to get the current version of the app.

You would have to use Cordova AppVersion plugin instead.

After install (e.g. cordova plugin add cordova-plugin-app-version), you can this JS code:

cordova.getAppVersion.getVersionNumber().then(function (version) {
    $('.version').text(version);
});

Here is the list of methods which you can use to retrieve other details about your application:

  • getAppName

    Returns the name of the app. E.g. "My Awesome App"

  • getPackageName

    Returns the package name of the app - the reversed domain name app identifier like com.example.myawesomeapp.

  • getVersionCode

    Returns the build identifier of the app

  • getVersionNumber

    Returns the version number of the app


Related posts:

Upvotes: 3

Related Questions