mirror of https://github.com/M66B/NetGuard.git
Log version, catch unhandled exceptions
This commit is contained in:
parent
bad20add01
commit
f6a08965d4
|
@ -7,6 +7,7 @@
|
|||
<uses-permission android:name="com.android.vending.BILLING" />
|
||||
|
||||
<application
|
||||
android:name="ApplicationEx"
|
||||
android:allowBackup="false"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package eu.faircode.netguard;
|
||||
|
||||
import android.app.Application;
|
||||
import android.util.Log;
|
||||
|
||||
public class ApplicationEx extends Application {
|
||||
private static final String TAG = "NetGuard.App";
|
||||
|
||||
private Thread.UncaughtExceptionHandler mPrevHandler;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
Log.i(TAG, "Create version=" + Util.getSelfVersionName(this));
|
||||
|
||||
mPrevHandler = Thread.getDefaultUncaughtExceptionHandler();
|
||||
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
||||
@Override
|
||||
public void uncaughtException(Thread thread, Throwable ex) {
|
||||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
if (mPrevHandler != null)
|
||||
mPrevHandler.uncaughtException(thread, ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue