Beispiel #1
0
        public void Init(Context ctx)
        {
            this.mContext   = ctx;
            mDefaultHandler = Thread.DefaultUncaughtExceptionHandler;

            Thread.DefaultUncaughtExceptionHandler = this;
        }
        public override void OnCreate()
        {
            if (BuildConfig.DEBUG)
            {
                StrictMode.SetThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                                           .DetectCustomSlowCalls()
                                           .DetectNetwork()
                                           .PenaltyLog()
                                           .PenaltyDeath()
                                           .Build());
                StrictMode.SetVmPolicy(new StrictMode.VmPolicy.Builder()
                                       .DetectActivityLeaks()
                                       .DetectLeakedClosableObjects()
                                       .DetectLeakedRegistrationObjects()
                                       .DetectLeakedSqlLiteObjects()
                                       .PenaltyLog()
                                       .PenaltyDeath()
                                       .Build());
            }

            base.OnCreate();

            if (Settings.getVersion(this) != BuildConfig.VERSION_CODE)
            {
                Settings.setVersion(this);
            }

            mDefaultExceptionHandler = Thread.DefaultUncaughtExceptionHandler;
            Thread.DefaultUncaughtExceptionHandler = this;
        }
Beispiel #3
0
 public void init(Context context)
 {
     mContext = context;
     //获取系统默认的UncaughtException处理器  
     mDefaultHandler = Thread.DefaultUncaughtExceptionHandler;
     //设置该CrashHandler为程序的默认处理器  
     Thread.DefaultUncaughtExceptionHandler = this;
 }
        static void Fabric_AfterInitialize(object sender, EventArgs e)
        {
            _uncaughtExceptionHandler = Thread.DefaultUncaughtExceptionHandler;
            Thread.DefaultUncaughtExceptionHandler = _defaultExceptionHandler;

            AndroidEnvironment.UnhandledExceptionRaiser += (s, a) => UncaughtException(a.Exception);
            AppDomain.CurrentDomain.UnhandledException  += (s, a) => UncaughtException(a.ExceptionObject);
            TaskScheduler.UnobservedTaskException       += (s, a) => UncaughtException(a.Exception);
        }
        static void Fabric_BeforeInitialize(object sender, EventArgs e)
        {
            _defaultExceptionHandler = Thread.DefaultUncaughtExceptionHandler;

            Thread.DefaultUncaughtExceptionHandler = new DummyExceptionHandler();
        }
 public CustomExceptionHandler(Thread.IUncaughtExceptionHandler exceptionHandler)
 {
     Handle = exceptionHandler.Handle;
 }
Beispiel #7
0
 /**
  * ��ʼ��
  *
  * @param context
  */
 public void init(Context context)
 {
     mContext = context;
     //��ȡϵͳĬ�ϵ�UncaughtException������
     mDefaultHandler = Thread.DefaultUncaughtExceptionHandler;
     //���ø�CrashHandlerΪ�����Ĭ�ϴ�����
     Thread.DefaultUncaughtExceptionHandler = this;
 }