Android App Error and Exception Monitoring
Automatic crash detection for unhandled exceptions
If not disabled explicitly by setting GermainAPMConfiguration.setAutomaticUnhandledExceptionsMonitoring(false)
, detection of unhandled exceptions is automatically enabled and working once the Germain UX gets initiated. In addition we automatically collect Application Closed and Application Uptime events when a crash occurs.
Germain UX will collect the following categories of crashes if Android Os throws related unhandled exception:
Disk Write crash
Disk Read crash
Network Operation crash
Custom Slow Call
Resource Mismatch
Unbuffered IO
Cursor Leak
Closeable Leak
Activity Leak
Instance Leak
Registration Leak
File URI Exposure
Cleartext Network crash
Content URI Without Permission
Untagged Socket crash
Non SDK API Usage
If needed you can also collect a crash explicitly by calling the following code (that will also collect Application Closed and Application Uptime events so if you don't want to collect these better call GermainAPM.collectError()
or GermainAPM.collectException()
):
Java:
// ...
GermainAPM.collectCrash("CustomCrashName", e, false); // a) exception name b) Throwable content c) tell if it was an exception thrown by StrictMode or not (false means not in StrictMode policy)
// ...
Kotlin:
// ...
GermainAPM.collectCrash("CustomCrashName", e, false) // a) exception name b) Throwable content c) tell if it was an exception thrown by StrictMode or not (false means not in StrictMode policy)
// ...
Handled exception notification
You can collect an exception explicitly by adding the following code to your handled exception logic.
Simplest integration example:
Java:
try {
URL url = new URL("localhost");
} catch (MalformedURLException e) {
GermainAPM.collectException(e); // Just Throwable and we will do the rest
// application handled exception code here
}
Kotlin:
try {
URL url = new URL("localhost");
} catch (e: MalformedURLException) {
GermainAPM.collectException(e) // Just Throwable and we will do the rest
// application handled exception code here
}
Custom integration example:
Java:
try {
URL url = new URL("localhost");
} catch (MalformedURLException e) {
GermainAPM.collectException("CustomExceptionName", e, false); // More control as we can set a) exception name b) Throwable content c) tell if it was an exception thrown by StrictMode or not (false means not in StrictMode policy)
// application handled exception code here
}
Kotlin:
try {
URL url = new URL("localhost")
} catch (e: MalformedURLException) {
GermainAPM.collectException("CustomExceptionName", e, false) // More control as we can set a) exception name b) Throwable content c) tell if it was an exception thrown by StrictMode or not (false means not in StrictMode policy)
// application handled exception code here
}
Error notification
You can collect an error event explicitly by adding the following code to your code:
Java:
if(wrong_condition or value_is_wrong or an_error_occured_but_we_dont_throw_exception or ...){
GermainAPM.collectError("CustomErrorName", "CustomErrorContent");
// application logic here
}
Kotlin:
if(wrong_condition or value_is_wrong or an_error_occured_but_we_dont_throw_exception or ...){
GermainAPM.collectError("CustomErrorName", "CustomErrorContent")
// application logic here
}
Component: Mobile App
Feature Availability: 8.6.0 or later