Important
If you're using a hybrid mobile agent (React Native, .NET Maui, etc.), refer to the platform-specific methods below.
Important
As of version 5.3.0 of the New Relic Android agent, withApplicationBuild()
has replaced NewRelic.withBuildIdentifier()
.
Syntax
Java
NewRelic.withApplicationBuild(string $buildId)
Kotlin [#kotlin]
NewRelic.withApplicationBuild(buildId: String?)
Description [#description]
This call allows you to set a custom build identifier string that appears next to the application version in the Crash report page. Instead of using the versionCode
string defined in AndroidManifest.xml
, call the withApplicationBuild()
method and pass along the custom build ID as a string.
Parameters [#parameters]
Parameter | Type | Description |
---|---|---|
|
| Required. The string indicating build ID. |
Example [#example]
Java [#java]
NewRelic.withApplicationToken("").withApplicationBuild("156").start(this.getApplication());
Kotlin [#kotlin]
NewRelic.withApplicationToken("").withApplicationBuild("1").start(applicationContext)
Syntax
Objective-c
setApplicationBuild:(NSString *_Nonnull)versionString;
Swift [#swift]
NewRelic.setApplicationBuild:(NSString*)versionString;
Description [#description]
By default, New Relic uses the CFBundleVersion
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 this application's build number. |
Example [#example]
Objective-C [#obj-c]
[NewRelic setApplicationBuild:@"42"];
Swift [#swift]
NewRelic.setApplicationBuild("42")