public class

FirebasePerformance

extends Object
java.lang.Object
   ↳ com.google.firebase.perf.FirebasePerformance

Class Overview

Firebase Performance API. The API is automatically initialized by FirebaseApp.

Summary

Public Methods
static FirebasePerformance getInstance()
Returns a singleton of FirebasePerformance.
boolean isPerformanceCollectionEnabled()
Determines whether performance monitoring is enabled or disabled
Trace newTrace(String traceName)
Creates a Trace object with given name.
void setPerformanceCollectionEnabled(boolean enable)
Enables or disables performance monitoring.
static Trace startTrace(String traceName)
Creates a Trace object with given name and start the trace.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static FirebasePerformance getInstance ()

Returns a singleton of FirebasePerformance.

Returns
FirebasePerformance the singleton FirebasePerformance object.

public boolean isPerformanceCollectionEnabled ()

Determines whether performance monitoring is enabled or disabled

Returns
boolean boolean, true if performance monitoring is enabled and false if performance monitoring is disabled for dynamic enable/disable. This does not reflect if instrumentation is enabled/disabled in Gradle properties.

public Trace newTrace (String traceName)

Creates a Trace object with given name.

Parameters
traceName String: Name of the trace, requires no leading or trailing whitespace, no leading underscore '_' character, max length is 32 characters.
Returns
Trace the new Trace object.

public void setPerformanceCollectionEnabled (boolean enable)

Enables or disables performance monitoring. This setting is persisted and applied on future invocations of your application. By default, performance monitoring is enabled. If you need to change the default (for example, because you want to prompt the user before collecting performance stats), add

<meta-data android:name=firebase_performance_collection_enabled android:value=false />
 
to your application’s manifest. Changing the value during runtime will override the manifest value.

If you want to permanently disable sending performance metrics, add

<meta-data android:name="firebase_performance_collection_deactivated" android:value="true" />
 
to your application's manifest. Changing the value during runtime will not override the manifest value.

This is separate from enabling/disabling instrumentation in Gradle properties.

Parameters
enable boolean: Should performance monitoring be enabled

public static Trace startTrace (String traceName)

Creates a Trace object with given name and start the trace.

Parameters
traceName String: Name of the trace, requires no leading or trailing whitespace, no leading underscore '_' character, max length is 32 characters.
Returns
Trace the new Trace object.