nativescript-appinfo
Version:
Read the app details of your NativeScript app
69 lines (50 loc) • 2.32 kB
Markdown
# NativeScript App Info
> Read the app infos of your NativeScript app.
For iOS we read it from `*.plist`'s `CFBundleShortVersionString`.
For Android we read the `versionName` from `AndroidManifest.xml`.
[](https://greenkeeper.io/)
[](https://travis-ci.org/hypery2k/nativescript-appinfo)
[](https://martinreinhardt-online.de/jenkins/job/NPM/job/nativescript-appinfo/job/master/)
[](https://nodei.co/npm/nativescript-appinfo/)
> Feel free to **donate**
>
> <a href='http://www.pledgie.com/campaigns/25442'><img alt='Click here to lend your support to: Owncloud Apps and make a donation at www.pledgie.com !' src='http://www.pledgie.com/campaigns/23447.png?skin_name=chrome' border='0' /></a>
> <a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AGPGLZYNV6Y5S">
> <img alt="" border="0" src="https://www.paypalobjects.com/de_DE/DE/i/btn/btn_donateCC_LG.gif"/>
> </img></a>
> Or donate [Bitcoins](bitcoin:3NKtxw1SRYgess5ev4Ri54GekoAgkR213D):
> [](bitcoin:3NKtxw1SRYgess5ev4Ri54GekoAgkR213D)
>
> Also via [greenaddress](https://greenaddress.it/pay/GA3ZPfh7As3Gc2oP6pQ1njxMij88u/)
## Installation
Run the following command from the root of your project:
```
tns plugin add nativescript-appinfo
```
Or if you want to use the development version (nightly build), which maybe not stable!:
```
tns plugin add nativescript-appinfo@next
```
## Usage
To use this plugin you must first require() it:
```js
var appinfo = require("nativescript-appinfo");
```
### getVersionName
```js
appinfo.getVersionName().then(function(v) {
console.log("Your app's version is: " + v);
});
```
### getBuildNumber
```js
appinfo.getBuildNumber().then(function(v) {
console.log("Your app's build is: " + v);
});
```
### getAppId
```js
appinfo.getAppId().then(function(id) {
console.log("Your app's id is: " + id);
});
```