From my search, i got the below code for getting the Crash Log .
try {
Process process = Runtime.getRuntime().exec(\"logcat -d\");
BufferedReader buf
The best way to handle crash logs is creating an UncaughtExceptionHandler and handling it as per your requirement. Create a BaseActivity class and extend all the Activities with that and put this code stuff in the BaseActivity class.
private Thread.UncaughtExceptionHandler handleAppCrash =
new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread thread, Throwable ex) {
Log.e("error", ex.toString());
//send email here
}
};
Then just enable is inside onCreate() method of your BaseActivity by using
Thread.setDefaultUncaughtExceptionHandler(handleAppCrash);
So, now whenever there will be a crash in your Application uncaughtException() will be called and you will have to handle the crash accordingly.