1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2024-12-25 01:07:52 +00:00

Log version, catch unhandled exceptions

This commit is contained in:
M66B 2015-11-02 20:09:04 +01:00
parent bad20add01
commit f6a08965d4
2 changed files with 27 additions and 0 deletions

View file

@ -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"

View file

@ -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);
}
});
}
}