Sending errors on Android
To send your own error message, use the following methods:
AppMetrica.reportError(String message, Throwable error)
AppMetrica.reportError(String groupIdentifier, String message)
AppMetrica.reportError(String groupIdentifier, String message, Throwable error)
Example with groupIdentifier
If you send errors using methods with groupIdentifier, they are grouped by ID.
Kotlin
Java
try {
"00xffWr0ng".toInt()
} catch (error: Throwable) {
AppMetrica.reportError("Your ID", "Error while parsing some integer number", error)
}
try {
Integer.valueOf("00xffWr0ng");
} catch (Throwable error) {
AppMetrica.reportError("Your ID", "Error while parsing some integer number", error);
}
Don't use variable values as grouping IDs. Otherwise, the number of groups increases and it becomes difficult to analyze them.
Example with message
If errors are sent using the AppMetrica.reportError(String message, Throwable error)
method, they are grouped by stack trace.
Kotlin
Java
try {
"00xffWr0ng".toInt()
} catch (error: Throwable) {
AppMetrica.reportError("Error while parsing some integer number", error)
}
try {
Integer.valueOf("00xffWr0ng");
} catch (Throwable error) {
AppMetrica.reportError("Error while parsing some integer number", error);
}
If you didn't find the answer you were looking for, you can use the feedback form to submit your question. Please describe the problem in as much detail as possible. Attach a screenshot if possible.
Was the article helpful?
Previous