Read the current Package ID and Version (name and code) of your NativeScript app.
Run the following command from the root of your project:
tns plugin add nativescript-appversion
To use this plugin you must first require / import it:
var appversion = require("nativescript-appversion");
import * as appversion from "nativescript-appversion";
getVersionNameSync
is the same as getVersionName
, except it doesn't return a Promise.
appversion.getVersionName().then(function(v) {
console.log("Your app's version is: " + v);
});
appversion.getVersionName().then((v: string) => {
console.log("Your app's version is: " + v);
});
appversion.getVersionCode().then(function(v) {
console.log("Your app's version code is: " + v);
});
appversion.getVersionCode().then((v: string) => {
console.log("Your app's version code is: " + v);
});
appversion.getAppId().then(function(id) {
console.log("Your app's id is: " + id);
});
appversion.getAppId().then((id: string) => {
console.log("Your app's id is: " + id);
});