• EnglishEspañol日本語한국어Português
  • ログイン今すぐ開始

この機械翻訳は、参考として提供されています。

In the event of any inconsistency between the English version and the translated version, the English versionwill take priority. Please visit this page for more information.

問題を作成する

カスタム名のインタラクション

重要

ハイブリッド モバイル エージェント (React Native、.NET Maui など) を使用している場合は、以下のプラットフォーム固有の方法を参照してください。

構文

Java

NewRelic.setInteractionName(string $interactionName)

コトリン [#kotlin]

NewRelic.setInteractionName(name: String?)

説明 [#description]

New Relic がすでに追跡しているインタラクションに新しい名前を設定します。

インストルメント化されたアプリのインタラクションの名前を変更するには、 setInteractionName() を使用します。

たとえば、 FragmentActivityのような単一のアクティビティ名、または baseclass.aのような難読化された名前でレポートされているインタラクションがあり、そのインタラクションの名前をよりわかりやすい名前に変更したいとします。各 onCreate() メソッドの先頭で setInteractionName を使用して、名前を変更できます。

新しいインタラクションを作成するには、 startInteraction()を参照してください。

本APIの一般的な使用方法については、 Android SDK API usage guide をご参照ください。

パラメーター [#parameters]

パラメータ

タイプ

説明

$interactionName

string

必須項目です。インタラクションにつけたい名前。

[#example]

この例では、 Activity クラスの一部として onCreate() メソッドの先頭で NewRelic.setInteractionName() を使用します。

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]

NewRelic.setInteractionName("Display MyCustomInteraction")

構文

目的-c

- (NSString*) customNewRelicInteractionName;

迅速 [#swift]

@objc func customNewRelicInteractionName() -> String

説明 [#description]

名前を設定して、New Relic に報告されるデフォルトのインタラクション名を変更します。

このメソッドをUIViewControllerに実装すると、New Relic は ( -viewDidLoadまたは-viewDidAppearから) インタラクションを開始する前にこのメソッドを呼び出し、返された文字列でインタラクションの名前を変更します (デフォルト名のdisplay <ViewControllerName>ではなく)。 .

パラメーター [#parameters]

パラメータ

タイプ

説明

customNewRelicInteractionName

string

必要。カスタムインタラクション名。

[#examples]

Objective-C [#obj-c]

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

迅速 [#swift]

@objc func customNewRelicInteractionName() -> String {
return "CustomInteractionNameViewController"
}
Copyright © 2024 New Relic株式会社。

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.