java.lang.Object | |
↳ | com.google.firebase.crash.FirebaseCrash |
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.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Determine whether crash reporting is enabled or disabled
| |||||||||||
Logs a message that will appear in a subsequent crash report.
| |||||||||||
Logs a message that will appear in a subsequent crash report as well as in logcat.
| |||||||||||
Generates a crash report for the given caught exception.
| |||||||||||
Enable or disable crash reporting.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Determine whether crash reporting is enabled or disabled
Returns | |
---|---|
boolean |
boolean, true if crash reporting is enabled and false if crash reporting is disabled |
Logs a message that will appear in a subsequent crash report.
Parameters | |
---|---|
message |
String :
the message to log |
See also:
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 |
int :
the log level, one of the log level constants from Log . |
tag |
String :
the tag to use when logging to logcat |
message |
String :
the message to log |
See also:
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 |
Throwable :
the caught exception to report
|
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 |
boolean :
Should crash reporting be enabled
|