org.acra.collector.CrashReportData Java Examples

The following examples show how to use org.acra.collector.CrashReportData. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ErrorActivity.java    From Instagram-Profile-Downloader with MIT License 6 votes vote down vote up
public static void reportError(final Context context, final CrashReportData report, final ErrorInfo errorInfo) {
    // get key first (don't ask about this solution)
    ReportField key = null;
    for (ReportField k : report.keySet()) {
        if (k.toString().equals("STACK_TRACE")) {
            key = k;
        }
    }
    String[] el = new String[]{report.get(key).toString()};

    Intent intent = new Intent(context, ErrorActivity.class);
    intent.putExtra(ERROR_INFO, errorInfo);
    intent.putExtra(ERROR_LIST, el);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
}
 
Example #2
Source File: ErrorActivity.java    From video-transcoder with GNU General Public License v3.0 6 votes vote down vote up
public static void reportError(final Context context, final CrashReportData report, final ErrorInfo errorInfo)
{
    // get key first (don't ask about this solution)
    ReportField key = null;
    for (ReportField k : report.keySet())
    {
        if (k.toString().equals("STACK_TRACE"))
        {
            key = k;
        }
    }
    String[] el = new String[]{report.get(key).toString()};

    Intent intent = new Intent(context, ErrorActivity.class);
    intent.putExtra(ERROR_INFO, errorInfo);
    intent.putExtra(ERROR_LIST, el);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
}
 
Example #3
Source File: CrashReportSender.java    From Easy_xkcd with Apache License 2.0 6 votes vote down vote up
private String[] buildSubjectBody(Context context, CrashReportData errorContent) {
    ImmutableSet<ReportField> fields = this.config.getReportFields();
    if (fields.isEmpty()) {
        return new String[]{"No ACRA Report Fields found."};
    }

    String subject = context.getPackageName() + " Crash Report";
    StringBuilder builder = new StringBuilder();
    for (ReportField field : fields) {
        builder.append(field.toString()).append('=');
        builder.append(errorContent.get(field));
        builder.append('\n');
        if ("STACK_TRACE".equals(field.toString())) {
            String stackTrace = errorContent.get(field);
            if (stackTrace != null) {
                subject = context.getPackageName() + ": "
                        + stackTrace.substring(0, stackTrace.indexOf('\n'));
                if (subject.length() > 72) {
                    subject = subject.substring(0, 72);
                }
            }
        }
    }

    return new String[]{subject, builder.toString()};
}
 
Example #4
Source File: CrashReportSender.java    From fdroidclient with GNU General Public License v3.0 6 votes vote down vote up
private String[] buildSubjectBody(Context context, CrashReportData errorContent) {
    ImmutableSet<ReportField> fields = this.config.getReportFields();
    if (fields.isEmpty()) {
        return new String[]{"No ACRA Report Fields found."};
    }

    String subject = context.getPackageName() + " Crash Report";
    StringBuilder builder = new StringBuilder();
    for (ReportField field : fields) {
        builder.append(field.toString()).append('=');
        builder.append(errorContent.get(field));
        builder.append('\n');
        if ("STACK_TRACE".equals(field.toString())) {
            String stackTrace = errorContent.get(field);
            if (stackTrace != null) {
                subject = context.getPackageName() + ": "
                        + stackTrace.substring(0, stackTrace.indexOf('\n'));
                if (subject.length() > 72) {
                    subject = subject.substring(0, 72);
                }
            }
        }
    }

    return new String[]{subject, builder.toString()};
}
 
Example #5
Source File: AcraReportSender.java    From video-transcoder with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void send(@NonNull Context context, @NonNull CrashReportData report) throws ReportSenderException
{
    ErrorActivity.reportError(context, report,
            ErrorActivity.ErrorInfo.make(UserAction.UI_ERROR,"none",
                    "App crash, UI failure", R.string.app_ui_crash));
}
 
Example #6
Source File: CrashReportSender.java    From Easy_xkcd with Apache License 2.0 5 votes vote down vote up
public void send(@NonNull Context context, @NonNull CrashReportData errorContent) {
    Intent emailIntent = new Intent("android.intent.action.SENDTO");
    emailIntent.setData(Uri.fromParts("mailto", this.config.mailTo(), null));
    emailIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    String[] subjectBody = this.buildSubjectBody(context, errorContent);
    emailIntent.putExtra("android.intent.extra.SUBJECT", subjectBody[0]);
    emailIntent.putExtra("android.intent.extra.TEXT", subjectBody[1]);
    context.startActivity(emailIntent);
}
 
Example #7
Source File: CrashReportSender.java    From fdroidclient with GNU General Public License v3.0 5 votes vote down vote up
public void send(@NonNull Context context, @NonNull CrashReportData errorContent) {
    Intent emailIntent = new Intent("android.intent.action.SENDTO");
    emailIntent.setData(Uri.fromParts("mailto", this.config.mailTo(), null));
    emailIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    String[] subjectBody = this.buildSubjectBody(context, errorContent);
    emailIntent.putExtra("android.intent.extra.SUBJECT", subjectBody[0]);
    emailIntent.putExtra("android.intent.extra.TEXT", subjectBody[1]);
    context.startActivity(emailIntent);
}
 
Example #8
Source File: AcraReportSender.java    From Instagram-Profile-Downloader with MIT License 4 votes vote down vote up
@Override
public void send(@NonNull Context context, @NonNull CrashReportData report) {
    ErrorActivity.reportError(context, report,
            ErrorActivity.ErrorInfo.make(UserAction.UI_ERROR,"none",
                    "App crash, UI failure", R.string.app_ui_crash));
}
 
Example #9
Source File: MyApplication.java    From AndroidModulePattern with Apache License 2.0 4 votes vote down vote up
@Override
public void send(Context context, CrashReportData crashReportData) throws ReportSenderException {
    EmailIntentSender emailSender = new EmailIntentSender(getApplicationContext());
    emailSender.send(context, crashReportData);
}