Android Open Source - wigle-wifi-wardriving-badfork Wigle Uncaught Exception Handler






From Project

Back to project page wigle-wifi-wardriving-badfork.

License

The source code is released under:

/* * Copyright (c) 2010-2012, Andrew Carra, Robert Hagemann, Hugh Kennedy * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permi...

If you think the Android project wigle-wifi-wardriving-badfork listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package net.wigle.wigleandroid;
/*from  ww  w .j a v a2 s.c om*/
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;

public class WigleUncaughtExceptionHandler implements Thread.UncaughtExceptionHandler {
  private final Context applicationContext; 
  private final Thread.UncaughtExceptionHandler origHandler;
  private final PendingIntent pendingIntent;
  
  public WigleUncaughtExceptionHandler ( Context applicationContext, Thread.UncaughtExceptionHandler origHandler ) {
    this.applicationContext = applicationContext.getApplicationContext();
    this.origHandler = origHandler;
    
    // set up pending email intent to email stacktrace logs if needed
    final Intent errorReportIntent = new Intent( this.applicationContext, ErrorReportActivity.class );
    errorReportIntent.putExtra( ListActivity.ERROR_REPORT_DO_EMAIL, true );
    pendingIntent = PendingIntent.getActivity( this.applicationContext, 0,
        errorReportIntent, errorReportIntent.getFlags() );
  }
  
  public void uncaughtException( Thread thread, Throwable throwable ) {
    String error = "Thread: " + thread + " throwable: " + throwable;
    ListActivity.error( error );
    throwable.printStackTrace();
    
    ListActivity.writeError( thread, throwable, applicationContext );
    // set the email intent to go off in a few seconds
    AlarmManager mgr = (AlarmManager) applicationContext.getSystemService(Context.ALARM_SERVICE);
    mgr.set( AlarmManager.RTC, System.currentTimeMillis() + 5000, pendingIntent );

    // give it to the regular handler
    origHandler.uncaughtException( thread, throwable );
  }
}




Java Source Code List

net.wigle.wigleandroid.ConcurrentLinkedHashMap.java
net.wigle.wigleandroid.DBException.java
net.wigle.wigleandroid.DBResultActivity.java
net.wigle.wigleandroid.DashboardActivity.java
net.wigle.wigleandroid.DataActivity.java
net.wigle.wigleandroid.DatabaseHelper.java
net.wigle.wigleandroid.ErrorReportActivity.java
net.wigle.wigleandroid.LatLon.java
net.wigle.wigleandroid.ListActivity.java
net.wigle.wigleandroid.MainActivity.java
net.wigle.wigleandroid.MappingActivity.java
net.wigle.wigleandroid.NetworkActivity.java
net.wigle.wigleandroid.NetworkListAdapter.java
net.wigle.wigleandroid.NetworkType.java
net.wigle.wigleandroid.Network.java
net.wigle.wigleandroid.OpenStreetMapViewWrapper.java
net.wigle.wigleandroid.Pair.java
net.wigle.wigleandroid.QueryArgs.java
net.wigle.wigleandroid.QueryThread.java
net.wigle.wigleandroid.SSLConfigurator.java
net.wigle.wigleandroid.SettingsActivity.java
net.wigle.wigleandroid.SpeechActivity.java
net.wigle.wigleandroid.TTS.java
net.wigle.wigleandroid.WigleAndroid.java
net.wigle.wigleandroid.WigleService.java
net.wigle.wigleandroid.WigleUncaughtExceptionHandler.java
net.wigle.wigleandroid.background.AbstractBackgroundTask.java
net.wigle.wigleandroid.background.AlertSettable.java
net.wigle.wigleandroid.background.BackgroundGuiHandler.java
net.wigle.wigleandroid.background.FileUploaderListener.java
net.wigle.wigleandroid.background.FileUploaderTask.java
net.wigle.wigleandroid.background.HttpDownloader.java
net.wigle.wigleandroid.background.HttpFileUploader.java
net.wigle.wigleandroid.background.KmlWriter.java
net.wigle.wigleandroid.background.Status.java
net.wigle.wigleandroid.listener.BatteryLevelReceiver.java
net.wigle.wigleandroid.listener.GPSListener.java
net.wigle.wigleandroid.listener.PhoneState7.java
net.wigle.wigleandroid.listener.PhoneStateFactory.java
net.wigle.wigleandroid.listener.PhoneState.java
net.wigle.wigleandroid.listener.SsidSpeaker.java
net.wigle.wigleandroid.listener.WifiReceiver.java