JarodMS

Mobile App Development with Ionic, Angular, and More!

Menu
  • Home
  • Mobile Apps
  • About Me
  • Contact Me
  • Diary
Menu

Adding the Version Number in your app

Posted on November 20, 2019February 24, 2020 by Jarod

One of the things I like to do with my apps is to add the version number somewhere within the app. Most of the time I place it in the footer of the sidemenu or in the About page of the app. This of course is great for support purposes when the user has a problem and you want to know what version they are using.

Of course you don’t have to display the version at all. Another possibility would be to send the version number (along with device info) when the app user initiates your built-in contact form using “cordova-plugin-email-composer”. 

This isn’t a manual change though. It’s automated with a script to make it super easy. I’ve uploaded an example to GitHub that shows how this is done. https://github.com/jarodms/ionic4-sidemenu-version

[UPDATE] Master branch uses Angular 8 with Ionic 4.7.x; branch ‘ng5_ionic3’ uses the same concept but works for Angular 5 and Ionic 3.9.2

Example

Here’s what it looks like in the starter template sidemenu:

How does it work?

  1. During the postinstall script (after npm install), the version info is pulled from package.json and placed into src/assets/version.ts.
  2. This file is then imported in app.component.ts
  3. The version information is then shown in app.component.html in the <ion-footer>
  4. If you update the version number in package.json later, simply run node version.js

Why?

So why go through all this just for a version number? 

Well, now you only have to maintain the version number in one place, your package.json file. 

You probably have another script somewhere that bumps the package.json version number and then updates the version in config.xml, right? Me too. That’s three spots the version is located in. Now this can all be part of your build process and the version numbers are in sync.

Please follow:
error
Tweet
0

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Newsletter

Signup with your email address to receive news and updates.

Search

Recent Posts

  • Not able to call REST API on Android, but it works with iOS and Web App
  • Ionic – the platform was not ready when I was trying to get the location
  • My Dividend Meter
  • Angular app using Node, JSON server, NG-Bootstrap, and NgRx
  • LoadingController example showing “Loading…” message
  • Adding the Version Number in your app
  • PhoneGap Build – Config File
  • Example Angular 8 with NgRx and Redux DevTools
  • Update an Ionic4/Angular7 app to use Angular 8
  • Ionic 4 and Angular with PouchDB

Need Help?

I’m available for Ionic and Angular contract work. Contact me to get started.

My Links

All my apps on Google Play Store
All my apps on Apple App Store
GitHub
LinkedIn

Archives

  • October 2020
  • April 2020
  • March 2020
  • November 2019
  • October 2019
  • August 2019
  • November 2018
  • August 2018
  • July 2018

Categories

  • Angular
  • Beginner
  • Ionic
  • Ionic Component
  • PhoneGap Build
  • Uncategorized
  • Visual Notification

Available for Angular and Ionic freelance work including custom app development.

Tags

Angular AuthGuard component Custom Icon Firebase Font Awesome Geolocation Google Cloud Functions icons ionic3 Ionic4 iOS NgRx PhoneGap Build tabs VirtualScroll
© 2025 JarodMS | WordPress Theme by Superbthemes