Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

cordova-plugin-app-version

sampart68.4kMIT0.1.14TypeScript support: definitely-typed

Cordova plugin to return the version number of the current app

cordova, ecosystem:cordova, app, version, appversion, plugin

readme

Cordova AppVersion plugin [unsupported]

Reads the version of your app from the target build settings.

We're looking for maintainers!

Installation

With cordova-cli

If you are using cordova-cli, install with:

cordova plugin add cordova-plugin-app-version

With plugman

With a plain plugman, you should be able to install with something like:

plugman --platform <ios|android> --project <directory> --plugin https://github.com/sampart/cordova-plugin-app-version.git

Manually in iOS

TODO: Write these instructions

Manually in Android

TODO: Write these instructions

Use from Javascript

If you are using jQuery, AngularJS, WinJS or any Promise/A library (Bluebird), promise style is supported. Use something like:

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

If not, pass a callback function:

cordova.getAppVersion.getVersionNumber(function (version) {
    alert(version);
});

In addition to the version number you can also 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

Credits

Written by Robert (Jamie) Munro at White October

Various others have contributed fixes and new features. See the CHANGELOG.md for details.

Original code based on the following Stack Overflow posts:

changelog

0.1.14

  • Fixed browser platform check for config.xml Issue#128
  • Fix browser platform xhr error handling missing parameter Issue#118

0.1.13

0.1.12

  • Fixed version mismatch
  • Fixed browser platform install warning by removing unneeded feature tag

0.1.11

  • Switched to new repo location

0.1.10

  • Added browser platform

0.1.9

  • Renamed Windows8 platform to Windows

0.1.7

  • Add getPackageName feature (thanks to @gprasanth)
  • Add getAppName feature (thanks to @mirko77)
  • Fix for windows 8 (thanks to @deliriousrhino)
  • Fix version number in plugin.xml file

0.1.6

  • Split into two functions getAppVersion.getVersionNumber() and getAppVersion.getVersionCode() to return build number
  • Fix a deprecation warning in iOS version

0.1.5

  • iOS: Return version number but log and fall back to build number if it is nil (thanks to Eddy Verbruggen)

0.1.4

  • Return version number, not build number on iOS (thanks to http://www.humancopy.net)
  • Support for Windows phone 8 (thanks to Cristi Badila / Gediminas Šaltenis)
  • Support for AngularJS as well as jQuery (thanks to Matias Singers, Red Ape Solutions)

0.1.3

  • Fixes to Android for Corova 3 and above (thanks to AxoInsanit)

0.1.2

  • Updated for Cordova 3 and above (thanks to Russell Keith-Magee freakboy3742

0.1.1

  • Improved README
  • Bug fix for non-jQuery use
  • Tidy plugin.xml

0.1.0

  • First release