tolmachevroman / AcraSlack

Sample project for Android Studio showing how to implement ACRA and Slack integration
9 stars 7 forks source link

AcraSlack

[ACRA] (https://github.com/ACRA/acra) is a very popular open-source bug tracking library for Android. Normally you would need your own backend to collect reports, however it is possible to integrate ACRA into your Slack account directly.

Firstly, you need to add ACRA to your project. In Android Studio it means adding dependency to Gradle
compile 'ch.acra:acra:4.6.1'
and initializing ACRA in your [Application class] (https://github.com/tolmachevroman/AcraSlack/blob/master/AcraSlackSample/app/src/main/java/com/acra/slack/sample/application/AcraSlackSample.java)
@ReportsCrashes()
public class AcraSlackSample extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        ClientApi.initialize();

        ACRA.init(this);
        ACRA.getErrorReporter().setReportSender(new CrashSender());
    }

}
Then, you need to add Incoming Webhooks API integration.

webhooks

Create new channel for bugs only

webhooks2

and copy it's url to [Urls class] (https://github.com/tolmachevroman/AcraSlack/blob/master/AcraSlackSample/app/src/main/java/com/acra/slack/sample/network/Urls.java)
public static final String SLACK_ENDPOINT = "https://hooks.slack.com/services";
public static final String SLACK_CRASH_CHANNEL = "/M03H6CG1F/B07V91KN6/T8HANY51iQygHlckHX8KQ0Zk";
For more info, please check [official documentation] (https://api.slack.com/incoming-webhooks)
That's it! Now each time your app is crashed you'll receive nice instant message right into your Slack channel.

acrasamplescreenshot