Crashlytics

Additional

Language
Java
Version
N/A
Created
Nov 20, 2017
Updated
Nov 29, 2017
Owner
Karthik Periasami (karthyks)
Contributor
Karthik Periasami (karthyks)
1
Activity
Badge
Generate
Download
Source code
APK file

Announcement

Crashlytics-Android

Gradle :

compile 'com.github.karthyks:crashlytics:1.0.1'

Usage :
First step is to initialize Crashlytics inside your application class, along with a CustomCrashEvent class instance, as shown below

Crashlytics.init(Application, new CrashHandler());

Typical CrashHandler class will look like mentioned below.

// This class runs on a different thread,  UI related tasks should not be executed inside this class.
public class CrashHandler extends CustomCrashEvent {
 @Override
  public void onEventOccurred(List<EventModel> eventModels) throws Exception {
    
  }
}

If your app has login feature, then the user info can be injected into the Crashlytics, to obtain info about the crashes and events once happened.
Crashlytics.login(company, userid);


In case of any exception thrown in the onEventOccurred method, then the events are stored locally in the db. Once if there are any locally stored events found, then a background service will run every 15 minutes by default, which in turn keeps on triggering the onEventOccurred method, until it passes. The 15 minutes interval can be tweaked by changing CrashEvent.ALARM_FREQUENCY.