• /
  • EnglishEspañol日本語한국어Português
  • Log inStart now

Set application version

Important

If you're using a hybrid mobile agent (React Native, .NET Maui, etc.), refer to the platform-specific methods below.

Syntax

Java

NewRelic.withApplicationVersion(string $appVersion)

Kotlin

NewRelic.withApplicationVersion(appVersion: String?)

Description

By default, the New Relic Android agent gets the app version from the AndroidManifest.xml or build.gradle. This method lets you override that value and set an app version by passing the app version. The app version is displayed as a dropdown in the New Relic UI, and you can use it to sort interactions.

Parameters

Parameter

Type

Description

$appVersion

string

Required. String indicating the application version.

Example

Java

NewRelic.withApplicationToken("").withApplicationVersion("1.23.4").start(this.getApplication());

Kotlin

NewRelic.withApplicationToken("").withApplicationVersion("1.23.4").start(applicationContext)

Syntax

Objective-c

setApplicationVersion:(NSString *_Nonnull)versionString;

Swift

NewRelic.setApplicationVersion:(NSString*)versionString;

Description

By default, New Relic uses the CFBundleShortVersionString when reporting the build number. But you can override the reported build number by calling this method (before calling startWithApplicationToken).

Parameters

Parameter

Type

Description

versionString

NSString

Required. The string to display as this application's version.

Example

Objective-C

[NewRelic setApplicationVersion:@"1.2.3"];

Swift

NewRelic.setApplicationVersion("1.2.3")
Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.