---
title: Custom name interactions
source: https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile/mobile-sdk/name-interaction
---

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

## Android

### Syntax [#syntax]

#### Java [#java]

```java
NewRelic.setInteractionName(string $interactionName)
```

#### Kotlin [#kotlin]

```kotlin
NewRelic.setInteractionName(name: String?)
```

### Description [#description]

Set a new name for an interaction that is already being tracked by New Relic.

Use `setInteractionName()` to change the name of an interaction in an instrumented app.

For example, you have an interaction that is being reported under a single activity name, like `FragmentActivity`, or under an obfuscated name, like `baseclass.a`, and you want to rename the interaction to be more descriptive,. You could use `setInteractionName` at the beginning of each `onCreate()` method to change the name.

To create a new interaction, see `startInteraction()`.

For general info on using this API, see the [Android SDK API usage guide](https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile-android/install-configure/work-android-sdk-api).

### Parameters [#parameters]

| Parameter          | Type     | Description                                             |
| ------------------ | -------- | ------------------------------------------------------- |
| `$interactionName` | `string` | Required. The name you want to give to the interaction. |

### Example [#example]

This example uses `NewRelic.setInteractionName()` at the beginning of the `onCreate()` method as part of the `Activity` class:

#### Java [#java]

```java
public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {

      //Rename the in-flight interaction
        NewRelic.setInteractionName("Display MyCustomInteraction");
    }

    // ... continue methods ...
}
```

#### Kotlin [#kotlin]

```kotlin
NewRelic.setInteractionName("Display MyCustomInteraction")
```

## iOS

### Syntax [#syntax]

#### Objective-c [#objc]

```objectivec
- (NSString*) customNewRelicInteractionName;
```

#### Swift [#swift]

```swift
@objc func customNewRelicInteractionName() -> String
```

### Description [#description]

Sets the name to rename default interaction names reported to New Relic.

If you implement this method in your `UIViewController`, New Relic will call this method before starting an interaction (from `-viewDidLoad` or `-viewDidAppear`) and rename the interaction with the string returned (instead of the default name of `display <ViewControllerName>`).

### Parameters [#parameters]

| Parameter                       | Type     | Description                            |
| ------------------------------- | -------- | -------------------------------------- |
| `customNewRelicInteractionName` | `string` | Required. The custom interaction name. |

### Examples [#examples]

#### Objective-C [#obj-c]

```objectivec
- (NSString*) customNewRelicInteractionName {
    return @"CustomInteractionNameViewController";
}
```

#### Swift [#swift]

```swift
@objc func customNewRelicInteractionName() -> String {
    return "CustomInteractionNameViewController"
}
```
