Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15267] Android: Expose versionName and versionCode inside the Ti.App.Android

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-03-07T19:03:40.000+0000
Affected Version/sn/a
Fix Version/s2014 Sprint 05, 2014 Sprint 05 API, Release 3.3.0
ComponentsAndroid
Labelsandroid, module_app, qe-testadded, version, versioning
ReporterYgor Lemos
AssigneeSunila
Created2013-09-11T22:21:32.000+0000
Updated2014-04-23T00:43:03.000+0000

Description

I think it would be very useful to expose the versionName and versionCode on Ti.Platform. First for creating dynamic About Windows and for internal migration procedures relying on this information. And second (and this is the most important for me), for getting the app build number that the client is using. This is specially useful for Beta Testing (through the Google Play Store) and for fast iteration of app versions, when you need to identify which version/build the user is running. This way I can always get the accurate user's app build number. There is a way of doing that in Android SDK:
PackageInfo pinfo = getPackageManager().getPackageInfo(getPackageName(), 0);
int versionCode = pinfo.versionCode;
String versionName = pinfo.versionName;
I think you guys should map that inside Ti.Platform so we can access it dynamically. Something like Ti.Platform.versionCode and Ti.Platform.versionName (of course they are Android only).

Comments

  1. Ygor Lemos 2013-09-26

    Why this was marked as Incomplete?
  2. Sunila 2013-12-18

    Exposed app VersionName and VersionCode https://github.com/appcelerator/titanium_mobile/pull/5145
  3. Sunila 2014-02-06

    Test case Ti.API.info("AppVersionCode = "+ Ti.Media.Android.appVersionCode + " AppVersionName = " +Ti.Media.Android.appVersionName);
  4. Ygor Lemos 2014-02-17

    @Sunila Ti.Media ???
  5. Sunila 2014-03-03

    My bad, I have updated the pull request Test case Ti.API.info("AppVersionCode = "+ Ti.App.Android.appVersionCode + " AppVersionName = " +Ti.App.Android.appVersionName);

JSON Source