i want to handle exceptions in Service.
my exception handler sends error report email.
so i add FLAG_ACTIVITY_NEW_TASK flag and it works fine in onCreate().
but in UncaughtExceptionHandler, it doesn't send email.
so how it can send email in uncaughtException()?
public class ErrorReporter implements Thread.UncaughtExceptionHandler
{
//....
public void uncaughtException(Thread t, Throwable e) {
// ...
SendErrorMail(this.CurContext, Report);
}
private void SendErrorMail(Context _context, String ErrorContent) {
Intent sendIntent = new Intent(Intent.ACTION_SEND);
String subject = ("Crash Report - Android ErrorReporter");
String body = ErrorContent + "\n\n";
sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[]
{"[email protected]"});
sendIntent.putExtra(Intent.EXTRA_TEXT, body);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
sendIntent.setType("message/rfc822");
Intent i = Intent.createChooser(sendIntent, "Title:");
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // because
Service ...
_context.startActivity(i);
}
}
thank you
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en