중요
If you're using a hybrid mobile agent (React Native, .NET Maui, etc.), refer to the platform-specific methods below.
중요
As of version 5.3.0 of the New Relic Android agent, withBuildIdentifier()
has replaced NewRelic.withApplicationBuild()
.
Syntax
Java
NewRelic.withApplicationBuild(string $buildId)
Kotlin
NewRelic.withApplicationBuild(buildId: String?)
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
Parameter | Type | Description |
---|---|---|
|
| Required. The string indicating build ID. |
Example
Java
NewRelic.withApplicationToken("").withApplicationBuild("156").start(this.getApplication());
Kotlin
NewRelic.withApplicationToken("").withApplicationBuild("1").start(applicationContext)
Syntax
Objective-c
setApplicationBuild:(NSString *_Nonnull)versionString;
Swift
NewRelic.setApplicationBuild:(NSString*)versionString;
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
Parameter | Type | Description |
---|---|---|
|
| Required. The string to display this application's build number. |
Example
Objective-C
[NewRelic setApplicationBuild:@"42"];
Swift
NewRelic.setApplicationBuild("42")