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 [#kotlin]
NewRelic.withApplicationVersion(appVersion: String?)
Description [#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 [#parameters]
Parameter | Type | Description |
---|---|---|
|
| Required. String indicating the application version. |
Example [#example]
Java [#java]
NewRelic.withApplicationToken("").withApplicationVersion("1.23.4").start(this.getApplication());
Kotlin [#kotlin]
NewRelic.withApplicationToken("").withApplicationVersion("1.23.4").start(applicationContext)
Syntax
Objective-c
setApplicationVersion:(NSString *_Nonnull)versionString;
Swift [#swift]
NewRelic.setApplicationVersion:(NSString*)versionString;
Description [#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 [#parameters]
Parameter | Type | Description |
---|---|---|
|
| Required. The string to display as this application's version. |
Example [#example]
Objective-C [#obj-c]
[NewRelic setApplicationVersion:@"1.2.3"];
Swift [#swift]
NewRelic.setApplicationVersion("1.2.3")