How to read version number (config.xml file) from ios phonegap application?

I want to check the version update through the IOS Phonegap application. Is there any possible way to get the current version code of the application. please help me read this version code from config.xml file.

+6
source share
3 answers

I'm late to the party, but none of the answers / plugins suit me (I wanted to do this without a plugin). If Cordoba has a way to get the version through Cordoba. * Api, Then I did not see this documentation anywhere, so I came up with a different method.

Before creating the application, I automatically create the www/version.js file and include it in my index.html application:

 cat config.xml \ | grep '^<widget' \ | sed -E 's|^.*version="([^"]+)".*|var cordova_app_version = "\1";|' \ > www/version.js 

You can then access your version of the application using the global variable cordova_app_version .

Please note that I do this in my Makefile project, which controls the entire building / launch, so this step is automated every time I make an assembly. Obviously, you will need to configure make / bash with cat / grep / sed.

+4
source

you can use the navigator plugin to get the version number, the version number in config.xml is added to your manifest / plist.

navigator.appInfo.getVersion ();

+1
source

If you use the version number in the .plist project (you still need to increase it to download new versions of the application in iTunes Connect), you can easily read this version number using this Phonegap plugin by calling window.wizUtils.getBundleVersion()

0
source

Source: https://habr.com/ru/post/954153/


All Articles