Created
March 1, 2012 09:27
-
-
Save ashtom/1948535 to your computer and use it in GitHub Desktop.
Example Application class for HockeyApp and ACRA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.hockeyapp.android.demo; | |
import org.acra.ACRA; | |
import org.acra.annotation.ReportsCrashes; | |
import android.app.Application; | |
// Replace APP_ID with your App ID on HockeyApp | |
@ReportsCrashes(formKey="APP_ID") | |
public class MyApplication extends Application { | |
@Override | |
public void onCreate() { | |
ACRA.init(this); | |
ACRA.getErrorReporter().setReportSender(new HockeySender()); | |
super.onCreate(); | |
} | |
} |
@ReportsCrashes(buildConfigClass = MyApplication.class) has been edited from 4.8.0+ , use
@ReportsCrashes(reportSenderFactoryClasses ={HockeySenderFactory.class})
public class MyApplication extends Application
ACRA.getErrorReporter().setReportSender(new HockeySender()); has been removed also, so we don't use this method again. We should create a class HockeySenderFactory implements ReportSenderFactory, like the code bellow:
public class HockeySenderFactory implements ReportSenderFactory {
@NonNull
@Override
public ReportSender create(Context context, ACRAConfiguration config) {
return new HockeySender();
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
formKey is deprecated from Acra 4.5+. Use:
and in your HockeySender, if you use it: