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:
parent
bad20add01
commit
f6a08965d4
2 changed files with 27 additions and 0 deletions
|
@ -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"
|
||||
|
|
26
app/src/main/java/eu/faircode/netguard/ApplicationEx.java
Normal file
26
app/src/main/java/eu/faircode/netguard/ApplicationEx.java
Normal 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue