Application Version

This article will describe how the application version is deduced automatically by the monitor (if possible), and how you can override that mechanism and provide an explicit version number if needed.

The Application Version

You application will report its version number as part of the session data. The version number is a dot-separated string "major.minor" with optional build and revision numbers - for example "3.4.3".

The version number is a vital aspect of your application. For instance, the global filters can filter everything based on versions. It is also represented in the Version report, as in this example:

The Version report for a product going from version 1.x to 3.x

Getting the version right is therefore quite important.

On some platforms the monitor can deduce this automatically. On others it has to be provided explicitly by hand. However, on all platforms it can be specified explicitly if you want to.

Automatic versioning

The table below show on what platforms the monitor can deduce the application version by itself, and how it is done:

Platform Versioning
Android Manual, but use this coding practice:

// In an activity:
context = some activity;
PackageManager packageManager = context.getPackageManager();
String packageName = context.getPackageName();
String version = packageManager.getPackageInfo(packageName, 0).versionName;
iOS Manual, but use this coding practice:

version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
Java
Javascript
MacOS
Windows C/C++
Manual only, no recommended best practice
AppBuilder Taken from project > Properties > Version
Full .NET Taken from Assembly.GetEntryAssembly() or if null then
from Assembly.GetCallingAssembly()
Compact Framework
Silverlight
Windows Phone
Windows COM
Taken from Assembly.GetCallingAssembly()
WinRT Manual, but use this coding practice:

var v = GetType().GetTypeInfo().Assembly.GetName().Version;
var version = new AppVersion(v.Major, v.Minor, v.Build, v.Revision);
var settings = AnalyticsMonitorFactory.CreateSettings(ProductID, version);

Manual versioning

For those platforms where the application version cannot be deduced automatically, or where the automation does not produce the version number you desire, you can specify the version explicitly when creating the monitor or the monitor settings:

    // C# for .NET, Silverlight etc
    IAnalyticsMonitorSettings settings = AnalyticsMonitorFactory.CreateSettings("key");
    settings.Version = new Version(1,2,3,4);
    ' VB.NET
    Dim settings As IAnalyticsMonitorSettings = AnalyticsMonitorFactory.CreateSettings("key")
    settings.Version = new Version(1,2,3,4)
    // Javascript for Icenium and web apps
    var settings = global.plugins.EqatecAnalytics.Factory.CreateSettings("key");
    settings.Version = "1.2.3.4";
    // C++ for Windows
    IAnalyticsMonitorSettings *settings = AnalyticsMonitorFactory::CreateSettings("key", "1.2.3.4");
    // C for Windows
    Eqatec_IAnalyticsMonitorSettings *settings =
            Eqatec_AnalyticsMonitorFactory_CreateSettings("key", "1.2.3.4");
    // Objective-C for iOS and MacOSX
    EQATECAnalyticsMonitorSettings *settings =
            [EQATECAnalyticsMonitorSettings settingsWithProductId:@"key" version:@"1.2.3.4"];
    // Java for Android and Java
    IAnalyticsMonitorSettings settings =
            AnalyticsMonitorFactory.createSettings("key", new Version("1.2.3.4"));

Beware: version number format must be correct

If you pass along a version string that is not in the expected numeric format "major.minor" (or "major.minor.build" or "major.minor.build.revision") then the Create methods will fail in a platform-dependent manner. On .NET it will throw an exception, for instance.

Passing an invalid version string or product key is the only thing that will cause the API to fail. Please see the section on the monitor's General Behavior for more information.

Conclusion

On some platforms your application version can be deduced automatically. On others you will have to specify it manually. This article has given you an overview of the behavior on all platforms.

See Also

Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.