The Firebase Crashlytics API provides methods to annotate and manage fatal and non-fatal reports captured and reported to Firebase Crashlytics.
By default, Firebase Crashlytics is automatically initialized.
Call getInstance() to get the singleton instance of
FirebaseCrashlytics.
| Task<Boolean> |
checkForUnsentReports()
Checks a device for any fatal or non-fatal crash reports that haven't yet been sent to
Crashlytics.
|
| void |
deleteUnsentReports()
If automatic data collection is disabled, this method queues up all the reports on a device for
deletion.
|
| boolean |
didCrashOnPreviousExecution()
Checks whether the app crashed on its previous run.
|
| static FirebaseCrashlytics |
getInstance()
Gets the singleton
FirebaseCrashlytics instance. |
| void | |
| void | |
| void |
sendUnsentReports()
If automatic data collection is disabled, this method queues up all the reports on a device to
send to Crashlytics.
|
| void |
setCrashlyticsCollectionEnabled(boolean enabled)
Enables or disables the automatic data collection configuration for Crashlytics.
|
| void |
setCrashlyticsCollectionEnabled(Boolean enabled)
Enables or disables the automatic data collection configuration for Crashlytics.
|
| void |
setCustomKey(String key, long value)
Records a custom key and value to be associated with subsequent fatal and non-fatal reports.
|
| void |
setCustomKey(String key, String value)
Sets a custom key and value that are associated with subsequent fatal and non-fatal reports.
|
| void |
setCustomKey(String key, int value)
Sets a custom key and value that are associated with subsequent fatal and non-fatal reports.
|
| void |
setCustomKey(String key, boolean value)
Sets a custom key and value that are associated with subsequent fatal and non-fatal reports.
|
| void |
setCustomKey(String key, float value)
Sets a custom key and value that are associated with subsequent fatal and non-fatal reports.
|
| void |
setCustomKey(String key, double value)
Sets a custom key and value that are associated with subsequent fatal and non-fatal reports.
|
| void |
setCustomKeys(CustomKeysAndValues keysAndValues)
Sets multiple custom keys and values that are associated with subsequent fatal and non-fatal
reports.
|
| void |
Checks a device for any fatal or non-fatal crash reports that haven't yet been sent to Crashlytics. If automatic data collection is enabled, then reports are uploaded automatically and this always returns false. If automatic data collection is disabled, this method can be used to check whether the user opts-in to send crash reports from their device.
If automatic data collection is disabled, this method queues up all the reports on a device for deletion. Otherwise, this method is a no-op.
Checks whether the app crashed on its previous run.
Gets the singleton FirebaseCrashlytics instance.
The default FirebaseApp instance must be initialized before this function is called.
See
FirebaseApp for more information.
Logs a message that's included in the next fatal or non-fatal report.
Logs are visible in the session view on the Firebase Crashlytics console.
Newline characters are stripped and extremely long messages are truncated. The maximum log size is 64k. If exceeded, the log rolls such that messages are removed, starting from the oldest.
| message | the message to be logged |
|---|
Records a non-fatal report to send to Crashlytics.
| throwable | a Throwable to be recorded as a non-fatal event.
|
|---|
If automatic data collection is disabled, this method queues up all the reports on a device to send to Crashlytics. Otherwise, this method is a no-op.
Enables or disables the automatic data collection configuration for Crashlytics.
If this is set, it overrides any automatic data collection settings configured in the AndroidManifest.xml as well as any Firebase-wide settings.
If automatic data collection is disabled for Crashlytics, crash reports are stored on the
device. To check for reports, use the checkForUnsentReports() method. Use sendUnsentReports() to upload existing reports even when automatic data collection is
disabled. Use deleteUnsentReports() to delete any reports stored on the device without
sending them to Crashlytics.
| enabled | whether to enable automatic data collection. When set to false, the new
value does not apply until the next run of the app. To disable data collection by default
for all app runs, add the firebase_crashlytics_collection_enabled flag to your
app's AndroidManifest.xml.
|
|---|
Enables or disables the automatic data collection configuration for Crashlytics.
If this is set, it overrides any automatic data collection settings configured in the
AndroidManifest.xml as well as any Firebase-wide settings. If set to null, the override
is cleared.
If automatic data collection is disabled for Crashlytics, crash reports are stored on the
device. To check for reports, use the checkForUnsentReports() method. Use sendUnsentReports() to upload existing reports even when automatic data collection is
disabled. Use deleteUnsentReports() to delete any reports stored on the device without
sending them to Crashlytics.
| enabled | whether to enable or disable automatic data collection. When set to false, the new value does not apply until the next run of the app. When set to null, the override is cleared and automatic data collection settings are determined by the
configuration in your AndroidManifest.xml or other Firebase-wide settings.
|
|---|
Records a custom key and value to be associated with subsequent fatal and non-fatal reports.
Multiple calls to this method with the same key will update the value for that key.
The value of any key at the time of a fatal or non-fatal event will be associated with that event.
Keys and associated values are visible in the session view on the Firebase Crashlytics console.
A maximum of 64 key/value pairs can be written, and new keys added beyond that limit will be ignored. Keys or values that exceed 1024 characters will be truncated.
| key | A unique key |
|---|---|
| value | A value to be associated with the given key |
Sets a custom key and value that are associated with subsequent fatal and non-fatal reports.
Multiple calls to this method with the same key update the value for that key.
The value of any key at the time of a fatal or non-fatal event is associated with that event.
Keys and associated values are visible in the session view on the Firebase Crashlytics console.
Accepts a maximum of 64 key/value pairs. New keys beyond that limit are ignored. Keys or values that exceed 1024 characters are truncated.
| key | A unique key |
|---|---|
| value | A value to be associated with the given key |
Sets a custom key and value that are associated with subsequent fatal and non-fatal reports.
Multiple calls to this method with the same key update the value for that key.
The value of any key at the time of a fatal or non-fatal event is associated with that event.
Keys and associated values are visible in the session view on the Firebase Crashlytics console.
Accepts a maximum of 64 key/value pairs. New keys beyond that limit are ignored. Keys or values that exceed 1024 characters are truncated.
| key | A unique key |
|---|---|
| value | A value to be associated with the given key |
Sets a custom key and value that are associated with subsequent fatal and non-fatal reports.
Multiple calls to this method with the same key update the value for that key.
The value of any key at the time of a fatal or non-fatal event is associated with that event.
Keys and associated values are visible in the session view on the Firebase Crashlytics console.
Accepts a maximum of 64 key/value pairs. New keys beyond that limit are ignored. Keys or values that exceed 1024 characters are truncated.
| key | A unique key |
|---|---|
| value | A value to be associated with the given key |
Sets a custom key and value that are associated with subsequent fatal and non-fatal reports.
Multiple calls to this method with the same key update the value for that key.
The value of any key at the time of a fatal or non-fatal event is associated with that event.
Keys and associated values are visible in the session view on the Firebase Crashlytics console.
Accepts a maximum of 64 key/value pairs. New keys beyond that limit are ignored. Keys or values that exceed 1024 characters are truncated.
| key | A unique key |
|---|---|
| value | A value to be associated with the given key |
Sets a custom key and value that are associated with subsequent fatal and non-fatal reports.
Multiple calls to this method with the same key update the value for that key.
The value of any key at the time of a fatal or non-fatal event is associated with that event.
Keys and associated values are visible in the session view on the Firebase Crashlytics console.
Accepts a maximum of 64 key/value pairs. New keys beyond that limit are ignored. Keys or values that exceed 1024 characters are truncated.
| key | A unique key |
|---|---|
| value | A value to be associated with the given key |
Sets multiple custom keys and values that are associated with subsequent fatal and non-fatal
reports. This method is intended as an alternative to setCustomKey in order to reduce
the computational load of writing out multiple key/value pairs at the same time.
Multiple calls to this method with the same key update the value for that key.
The value of any key at the time of a fatal or non-fatal event is associated with that event.
Keys and associated values are visible in the session view on the Firebase Crashlytics console.
Accepts a maximum of 64 key/value pairs. If calling this method results in the number of custom keys exceeding this limit, only some of the keys will be logged (however many are needed to get to 64). Which keys are logged versus dropped is unpredictable as there is no intrinsic sorting of keys. Keys or values that exceed 1024 characters are truncated.
| keysAndValues | A dictionary of keys and the values to associate with each key |
|---|
Records a user ID (identifier) that's associated with subsequent fatal and non-fatal reports.
The user ID is visible in the session view on the Firebase Crashlytics console.
Identifiers longer than 1024 characters will be truncated.
| identifier | a unique identifier for the current user |
|---|