https://github.com/codex-team/hawk.android.catcher
Android errors Catcher module for Hawk.so
https://github.com/codex-team/hawk.android.catcher
Last synced: about 2 months ago
JSON representation
Android errors Catcher module for Hawk.so
- Host: GitHub
- URL: https://github.com/codex-team/hawk.android.catcher
- Owner: codex-team
- Created: 2017-10-22T20:05:12.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-11-25T20:29:42.000Z (over 3 years ago)
- Last Synced: 2025-03-28T11:11:39.024Z (2 months ago)
- Language: Kotlin
- Size: 1.37 MB
- Stars: 3
- Watchers: 22
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hawk Android catcher [](https://jitpack.io/#codex-team/hawk.android.catcher)
### Exception catcherThis library provides in-app errors catching and sending them to the [Hawk](https://hawk.so). monitoring system.
You can also send errors, which you caught in **try-catch**.**Minimum required Android SDK 16**
-----
### Connection
To connect the library, add the following code to your **build.gradle** config.
```
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
...
dependencies {
implementation 'com.github.codex-team:hawk.android.catcher:v3.0'
}
```
### Example
For cather activation add following code to your manifest (f.e. **UseSample**)```xml
```
**Parameters**
> **TOKEN** - unique authorization key. You can get token after garage.hawk.so registration
and to you application class
```java
public class UseSampleApp extends Application {public HawkExceptionCatcher exceptionCatcher;
public void defineExceptionCather()
{
exceptionCatcher = new HawkExceptionCatcher(this);
exceptionCatcher.start();
}
@Override
public void onCreate() {
super.onCreate();
defineExceptionCather();
}
}
```
**Input parameters**> **Context** - current application context
## Example
Catching **UncheckedException**
```java
void myTask() {
int d = 10 / 0;
}
...
myTask();
```
Caught exception will be send with **JSON** formatSending handled exceptions
```java
void myTask() {
try {
int d = 10 / 0;
} catch(ArithmeticException e) {
UseSampleApp.exceptionCatcher.caught(e);
//This method sends an exception with JSON-format
}
}
...
myTask();
```Wherein, without using the function **log()** in the **try-catch**, the error won't be sent.
```java
void myTask() {
try {
int d = 10 / 0;
} catch(ArithmeticException e) {
e.printStackTrace();
//The exception won't be sent
}
}
...
myTask();
```