Everything crashes, even Google apps. I use the Thread.setUncaughtExceptionHandler()following handler code:
package my.package;
import java.lang.Thread.UncaughtExceptionHandler;
import android.app.NotificationManager;
import android.content.Context;
public class CrashHandler implements UncaughtExceptionHandler
{
private static final int NOTIFICATION_ID = 12345;
private UncaughtExceptionHandler defaultUEH;
private NotificationManager notificationManager;
public CrashHandler(Context context)
{
this.defaultUEH = Thread.getDefaultUncaughtExceptionHandler();
notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
}
public void uncaughtException(Thread t, Throwable e)
{
if (notificationManager != null)
{
try
{
notificationManager.cancel(NOTIFICATION_ID);
}
catch (Throwable ex)
{
ex.printStackTrace();
}
}
notificationManager = null;
defaultUEH.uncaughtException(t, e);
}
}
source
share