FirebaseCrash

public class FirebaseCrash extends Object

This class was deprecated.
FirebaseCrash is going to be deprecated soon in favor of Crashlytics. Please migrate to Crashlytics SDK.

Firebase Crash reporting API. The API is automatically initialized by FirebaseApp.

To report caught exceptions, use report(Throwable).

To attach log messages to a crash report, use log(String) or logcat(int, String, String) at points during execution that will best help you know what happened prior to the crash.

This SDK uses FirebaseInstanceID to identify the app instance and periodically sends data to the Firebase backend. To stop sending this, use deleteInstanceId() and either disable this SDK or call FirebaseCrash.setCrashCollectionEnabled(false)

Public Method Summary

static FirebaseCrash
getInstance(FirebaseApp firebaseApp)
Returns the FirebaseCrash instance configured with the given firebaseApp.
static boolean
isCrashCollectionEnabled()
Determine whether crash reporting is enabled or disabled.
static void
log(String message)
Logs a message that will appear in a subsequent crash report.
static void
logcat(int level, String tag, String message)
Logs a message that will appear in a subsequent crash report as well as in logcat.
static void
report(Throwable throwable)
Generates a crash report for the given caught exception.
static void
setCrashCollectionEnabled(boolean enable)
Enable or disable crash reporting.

Inherited Method Summary

Public Methods

public static FirebaseCrash getInstance (FirebaseApp firebaseApp)

Returns the FirebaseCrash instance configured with the given firebaseApp.

public static boolean isCrashCollectionEnabled ()

Determine whether crash reporting is enabled or disabled.

Returns
  • true if crash reporting is enabled and false if disabled.

public static void log (String message)

Logs a message that will appear in a subsequent crash report.

Parameters
message the message to log

public static void logcat (int level, String tag, String message)

Logs a message that will appear in a subsequent crash report as well as in logcat. The logcat message will have the given log level and tag as would be used by println(int, String, String).

Parameters
level the log level, one of the log level constants from Log.
tag the tag to use when logging to logcat
message the message to log
See Also

public static void report (Throwable throwable)

Generates a crash report for the given caught exception. This method should be used for unexpected exceptions where recovery is not possible. For example:

try {
     // Some code here...
 } catch (Exception e) {
     // Don't know what to do with this...
     FirebaseCrash.log("Caught an unexpected exception while doing some work");
     FirebaseCrash.report(e);
 }
 
Parameters
throwable the caught exception to report

public static void setCrashCollectionEnabled (boolean enable)

Enable or disable crash reporting. This setting is persisted to local memory and applied on future invocations of your application. It will be used to override any settings specified in your manifest.

By default, crash reporting is enabled. If you need to change the default (for example, because you want to prompt the user before collecting crashes), add

            <meta-data android:name=firebase_crash_collection_enabled android:value=false />
 
to your application’s manifest.
Parameters
enable Should crash reporting be enabled

Send feedback about...

Need help? Visit our support page.