Ir a la consola

FirebaseAnalytics

public final class FirebaseAnalytics extends Object

The top level Firebase Analytics singleton that provides methods for logging events and setting user properties. See the developer guides for general information on using Firebase Analytics in your apps.

Applications can get an instance of this class by calling getInstance(Context). getInstance(Context) is thread safe and can be called from any thread.

Nested Class Summary

class FirebaseAnalytics.Event An Event is an important occurrence in your app that you want to measure. 
class FirebaseAnalytics.Param Params supply information that contextualize Events. 
class FirebaseAnalytics.UserProperty A UserProperty is an attribute that describes the app-user. 

Public Method Summary

Task<String>
getAppInstanceId()
Retrieves the app instance id from the service.
static FirebaseAnalytics
getInstance(Context context)
Returns the singleton FirebaseAnalytics interface.
void
logEvent(String name, Bundle params)
Logs an app event.
void
resetAnalyticsData()
Clears all analytics data for this app from the device and resets the app instance id.
void
setAnalyticsCollectionEnabled(boolean enabled)
Sets whether analytics collection is enabled for this app on this device.
void
setCurrentScreen(Activity activity, String screenName, String screenClassOverride)
Sets the current screen name, which specifies the current visual context in your app.
void
setMinimumSessionDuration(long milliseconds)
Sets the minimum engagement time required before starting a session. The default value is 10000 (10 seconds).
void
setSessionTimeoutDuration(long milliseconds)
Sets the duration of inactivity that terminates the current session. The default value is 1800000 (30 minutes).
void
setUserId(String id)
Sets the user ID property.
void
setUserProperty(String name, String value)
Sets a user property to a given value.

Inherited Method Summary

Public Methods

public Task<String> getAppInstanceId ()

Retrieves the app instance id from the service.

Returns
  • Task with the result of the retrieval

public static FirebaseAnalytics getInstance (Context context)

Returns the singleton FirebaseAnalytics interface.

Parameters
context the context used to initialize Firebase Analytics. Must