Skip to content
🔢 NativeScript plugin to retrieve the current version of the app
JavaScript
Branch: master
Clone or download
#1 Compare This branch is 8 commits behind EddyVerbruggen:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.npmignore
LICENSE
README.md
appversion.android.js
appversion.d.ts
appversion.ios.js
package.json

README.md

NativeScript AppVersion

Requires NativeScript 2.3.0 (because of iOS 10 compatibility), so upgrade if you're rocking a lower spec: npm install -g nativescript.

Read the version of your NativeScript app.

For iOS we read it from *.plist's CFBundleShortVersionString.

For Android we read the versionName from AndroidManifest.xml.

Installation

Run the following command from the root of your project:

tns plugin add nativescript-appversion

Usage

To use this plugin you must first require() it:

var appversion = require("nativescript-appversion");

getVersionName

JavaScript

  appversion.getVersionName().then(function(v) {
      console.log("Your app's version is: " + v);
  });

TypeScript

  appversion.getVersionName().then((v: string) {
      console.log("Your app's version is: " + v);
  });

getVersionCode

JavaScript

  appversion.getVersionCode().then(function(v) {
      console.log("Your app's version code is: " + v);
  });

TypeScript

  appversion.getVersionCode().then((v: string) {
      console.log("Your app's version code is: " + v);
  });

getAppId

JavaScript

  appversion.getAppId().then(function(id) {
      console.log("Your app's id is: " + id);
  });

TypeScript

  appversion.getAppId().then((id: string) {
      console.log("Your app's id is: " + id);
  });
You can’t perform that action at this time.