endInteraction

NewRelic.endInteraction(string $interactionID)
Ends a custom interaction.

Requirements

Compatible with all agent versions.

Description

New Relic ends all interactions automatically, but you can use endInteraction() to end a custom interaction early. The string ID is returned when you use the startInteraction() call.

This call has no effect if the interaction has already ended.

For general info on using this API, see the Android SDK API usage guide.

Parameters

Parameter Description

$interactionID

string

Required. The string ID for the interaction you want to end. This string is returned when you use startInteraction().

Example(s)

End an interaction

Here's an example of ending a custom interaction RefreshContacts:

public class MainActivity extends Activity {
  ...
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.action_refresh:
        String interactionId = NewRelic.startInteraction("RefreshContacts");
        ... 
        return true;
      default:
        NewRelic.endInteraction(interactionId);
        return super.onOptionsItemSelected(item);
    }
  }
  ...
}

For more help

Recommendations for learning more: