---
title: Set max event buffer time
source: https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile/mobile-sdk/set-max-event-buffer-time
---

## Android

### Syntax [#syntax]

#### Java [#java]

```java
NewRelic.setMaxEventBufferTime(int $maxBufferTimeInSec)
```

#### Kotlin [#kotlin]

```kotlin
NewRelic.setMaxEventBufferTime(maxBufferTimeInSec: Int)
```

### Description [#description]

Sets the event harvest cycle length.

This method sets the maximum time in seconds that the New Relic Android agent will store events in memory before including the buffered event to be sent to New Relic in the next [harvest cycle](https://docs.newrelic.com/docs/apm/new-relic-apm/getting-started/glossary#harvest-cycle).

-   Default is 60 seconds (1 minute).
-   Minimum value cannot be less than 60 seconds.
-   Maximum value should not be greater than 600 seconds.

    In other words, when the oldest event timestamp exceeds this custom configured time, the agent transmits the buffered content at the harvest cycle between each connection from a New Relic agent to the collector.

    See also [`setMaxEventPoolSize()`](https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile-android/android-sdk-api/setmaxeventpoolsize-android-sdk-api), which sets the maximum number of events that are stored by the agent during a harvest cycle.

    > #### ⚠️ IMPORTANT
    >
    > Be aware that reporting a large number of events, or reporting events too frequently, may impact app performance.

    ### Parameters [#parameters]

    | Parameter             | Type  | Description                                                                                                                                 |
    | --------------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------- |
    | `$maxBufferTimeInSec` | `int` | Required. The maximum time (in seconds) that the agent should store events in memory. The default value harvest cycle length is 60 seconds. |

    ### Example [#example]

    Here's an example to set max event buffer time to 300 seconds:

    #### Java [#java]

```java
boolean NewRelic.setMaxEventBufferTime(300);
```

#### Kotlin [#kotlin]

```kotlin
NewRelic.setMaxEventBufferTime(300)
```

## iOS

### Syntax [#syntax]

#### Objective-c [#objc]

```objectivec
+ (void) setMaxEventBufferTime:(unsigned int)seconds;
```

#### Swift [#swift]

```swift
NewRelic.setMaxEventBufferTime:(unsigned int)seconds;
```

### Description [#description]

Sets the event harvest cycle length. Default is 60 seconds.

This method sets the maximum time in seconds that the New Relic iOS agent will store events in memory before including the buffered event to be sent to New Relic in the next [harvest cycle](https://docs.newrelic.com/docs/accounts-partnerships/education/getting-started-new-relic/glossary#harvest-cycle).
In other words, when the oldest event timestamp exceeds this custom configured time, the agent transmits the buffered content at the harvest cycle between each connection from a New Relic agent to the collector. You must set this value after `Agent.start()` is called.

-   Default is 60 seconds (1 minute).
-   Minimum value cannot be less than 60 seconds.

    See also [`setMaxEventPoolSize()`](https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile/mobile-sdk/set-max-event-pool-size/), which lets you change the maximum size of the event pool.

    ### Parameters [#parameters]

    | Parameter | Type           | Description                                                                                                    |
    | --------- | -------------- | -------------------------------------------------------------------------------------------------------------- |
    | `seconds` | `unsigned int` | Required. The maximum amount of time in seconds that events can be buffered before they are sent to New Relic. |

    ### Examples [#examples]

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

```objectivec
BOOL fiveMinuteLimitSet = [NewRelic setMaxEventBufferTime:600];
```

#### Swift [#swift]

```swift
let fiveMinuteLimitSet = NewRelic.setMaxEventBufferTime(600)
```

## Capacitor

### Syntax [#syntax]

```typescript
setMaxEventBufferTime(options: { maxBufferTimeInSeconds: number; }) => void
```

### Description [#description]

Sets the event harvest cycle length. Default is 60 seconds (1 minute). Minimum value can not be less than 60 seconds. Maximum value should not be greater than 600 seconds.

### Parameters [#parameters]

| Parameter                | Type                                  | Description                                                                                                    |
| ------------------------ | ------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `options`                | `{ maxBufferTimeInSeconds: number; }` | Required. An object that contains the maximum buffer time in seconds.                                          |
| `maxBufferTimeInSeconds` | `number`                              | Required. The maximum amount of time in seconds that events can be buffered before they are sent to New Relic. |

### Example [#example]

```typescript
NewRelicCapacitorPlugin.setMaxEventBufferTime({ maxBufferTimeInSeconds: 60 });
```

## Cordova

### Syntax [#syntax]

```typescript
setMaxEventBufferTime(maxBufferTimeInSeconds: number): void;
```

### Description [#description]

Sets the event harvest cycle length. Default is 60 seconds (1 minute). Minimum value can not be less than 60 seconds. Maximum value should not be greater than 600 seconds.

### Parameters [#parameters]

| Parameter                | Type     | Description                                                                                                    |
| ------------------------ | -------- | -------------------------------------------------------------------------------------------------------------- |
| `maxBufferTimeInSeconds` | `number` | Required. The maximum amount of time in seconds that events can be buffered before they are sent to New Relic. |

### Example [#example]

```js
NewRelic.setMaxEventBufferTime(60);
```

## .NET MAUI

### Syntax [#syntax]

```csharp
SetMaxEventBufferTime(int maxBufferTimeInSec) void;
```

### Description [#description]

Sets the event harvest cycle length. Default is 60 seconds (1 minute). Minimum value can not be less than 60 seconds. Maximum value should not be greater than 600 seconds.

### Parameters [#parameters]

| Parameter            | Type  | Description                                                                                                    |
| -------------------- | ----- | -------------------------------------------------------------------------------------------------------------- |
| `maxBufferTimeInSec` | `int` | Required. The maximum amount of time in seconds that events can be buffered before they are sent to New Relic. |

### Example [#example]

```csharp
CrossNewRelic.Current.SetMaxEventBufferTime(200);
```

## Flutter

### Syntax [#syntax]

```typescript
setMaxEventBufferTime(int maxBufferTimeInSec) void;
```

### Description [#description]

Sets the event harvest cycle length. Default is 60 seconds (1 minute). Minimum value can not be less than 60 seconds. Maximum value should not be greater than 600 seconds.

### Parameters [#parameters]

| Parameter            | Type  | Description                                                                                                    |
| -------------------- | ----- | -------------------------------------------------------------------------------------------------------------- |
| `maxBufferTimeInSec` | `int` | Required. The maximum amount of time in seconds that events can be buffered before they are sent to New Relic. |

### Example [#example]

```dart
NewrelicMobile.instance.setMaxEventBufferTime(200);
```

## React Native

### Syntax [#syntax]

```js
setMaxEventBufferTime(maxBufferTimeInSeconds: number): void;
```

### Description [#description]

Sets the event harvest cycle length. Default is 60 seconds (1 minute). Minimum value can not be less than 60 seconds. Maximum value should not be greater than 600 seconds.

### Parameters [#parameters]

| Parameter                | Type     | Description                                                                                                    |
| ------------------------ | -------- | -------------------------------------------------------------------------------------------------------------- |
| `maxBufferTimeInSeconds` | `number` | Required. The maximum amount of time in seconds that events can be buffered before they are sent to New Relic. |

### Example [#example]

```js
NewRelic.setMaxEventBufferTime(60);
```

## Unity

### Syntax [#syntax]

```csharp
SetMaxEventBufferTime(int maxBufferTimeInSec) void;
```

### Description [#description]

Sets the event harvest cycle length. Default is 60 seconds (1 minute). Minimum value can not be less than 60 seconds. Maximum value should not be greater than 600 seconds.

### Parameters [#parameters]

| Parameter            | Type  | Description                                                                                                    |
| -------------------- | ----- | -------------------------------------------------------------------------------------------------------------- |
| `maxBufferTimeInSec` | `int` | Required. The maximum amount of time in seconds that events can be buffered before they are sent to New Relic. |

### Example [#example]

```csharp
NewRelicAgent.SetMaxEventBufferTime(200);
```

## Unreal Engine

### Syntax [#syntax]

```cpp
setMaxEventBufferTime(int64 maxBufferTimeInSec):void;
```

### Description [#description]

Sets the event harvest cycle length. Default is 60 seconds (1 minute). Minimum value can not be less than 60 seconds. Maximum value should not be greater than 600 seconds.

### Parameters [#parameters]

| Parameter            | Type  | Description                                                                                                    |
| -------------------- | ----- | -------------------------------------------------------------------------------------------------------------- |
| `maxBufferTimeInSec` | `int` | Required. The maximum amount of time in seconds that events can be buffered before they are sent to New Relic. |

### Example [#example]

```cpp
UNewRelicBPLibrary::setMaxEventBufferTime(60);
```
