---
title: Record replay
source: https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile/mobile-sdk/record-replay
---

## Android

### Syntax [#syntax]

#### Java [#java]

```java
NewRelic.recordReplay()
```

#### Kotlin [#kotlin]

```kotlin
NewRelic.recordReplay()
```

### Requirements

-   Android agent v7.7.0 or higher.

    ### Description

    `NewRelic.recordReplay()` can be called to manually force a replay to begin recording. You must meet the following requirements:

-   Account is entitled to record replays

    If a replay is already in progress, or not all of the above criteria are met, this API method will have no effect.

    For information about pausing and resuming a replay, refer to [`NewRelic.pauseReplay()`](https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile/mobile-sdk/pause-replay)

    ### Use Cases

-   You want to manually trigger a replay to record on certain site pages or under certain conditions, regardless of the sampling settings.

    ### Example [#example]

    Here's an example of forcing a replay to start recording.

    #### Java [#java]

```java
public class MainActivity extends Activity {
  ...
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.record_replay:
        NewRelic.recordReplay();
      ...
        return true;
      default:
        return super.onOptionsItemSelected(item);
    }
  }
  ...
}
```

#### Kotlin [#kotlin]

```kotlin
class MainActivity : AppCompatActivity() {

  ...
  var client: OkHttpClient = OkHttpClient();

      binding.fab.setOnClickListener { view ->

          NewRelic.recordReplay()
          }
      }
    ...
```

## iOS

### Syntax [#syntax]

#### Objective-c [#objc]

```objective-c
      [NewRelic recordReplay];
```

#### Swift [#swift]

```swift
      NewRelic.recordReplay()
```

### Requirements

-   iOS agent v7.6.1 or higher.

    ### Description

    `NewRelic.recordReplay()` can be called to manually force a replay to begin recording. You must meet the following requirements:

-   Account is entitled to record replays

    If a replay is already in progress, or not all of the above criteria are met, this API method will have no effect.

    For information about pausing and resuming a replay, refer to [`NewRelic.pauseReplay()`](https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile/mobile-sdk/pause-replay)

    ### Use Cases

-   You want to manually trigger a replay to record on certain site pages or under certain conditions, regardless of the sampling settings.

    ### Example [#example]

    Here's an example of forcing a replay to start recording.

    #### Swift [#swift]

```swift
    override func viewDidDisappear(_ animated: Bool) {
        super.viewDidDisappear(animated)
        
        // Resume session replay only if we successfully paused it, we only want to start the replay back up if it was recording already
        if wasReplayPaused {
            let resumed = NewRelic.recordReplay()
            wasReplayPaused = false
        }
    }
```

## React Native

### Syntax [#syntax]

```
NewRelic.recordReplay()
```

### Requirements

-   React Native v1.7.0 or higher.

    ### Description

    `NewRelic.recordReplay()` can be called to manually force a replay to begin recording. You must meet the following requirements:

-   Account is entitled to record replays

    If a replay is already in progress, or not all of the above criteria are met, this API method will have no effect.

    For information about pausing and resuming a replay, refer to [`NewRelic.pauseReplay()`](https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile/mobile-sdk/pause-replay)

    ### Use Cases

-   You want to manually trigger a replay to record on certain site pages or under certain conditions, regardless of the sampling settings.

    ### Example [#example]

    Here's an example of forcing a replay to start recording.

```
NewRelic.recordReplay();
```
