org.acra.data.CrashReportData Java Examples

The following examples show how to use org.acra.data.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: CustomHttpSender.java    From mosmetro-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void send(Context context, CrashReportData report) throws ReportSenderException {
    JSONObject build_config = (JSONObject) report.get(ReportField.BUILD_CONFIG.toString());
    if (build_config == null) return;

    try {
        Object branch = build_config.get("BRANCH_NAME");
        Object build = build_config.get("BUILD_NUMBER");

        if (branch != null && build != null) {
            report.put(ReportField.APP_VERSION_NAME, branch.toString() + " #" + build.toString());
            report.put(ReportField.APP_VERSION_CODE, Integer.parseInt(build.toString()));
        }
    } catch (JSONException|NumberFormatException ignored) {}

    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
    if (!settings.getBoolean("pref_debug_last_log", true)) {
        report.put(ReportField.APPLICATION_LOG, (String) null);
    } else {
        String log = (String) report.get(ReportField.APPLICATION_LOG.toString());
        if (log != null) {
            int cut = log.lastIndexOf(Logger.CUT);
            if (cut != -1) {
                log = log.substring(cut + Logger.CUT.length() + 1);
                report.put(ReportField.APPLICATION_LOG, log);
            }
        }
    }

    super.send(context, report);
}
 
Example #2
Source File: ApplicationExFilter.java    From tracker-control-android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean shouldSendReport(@NonNull Context context, @NonNull CoreConfiguration config, @NonNull CrashReportData crashReportData) {
    return !crashReportData.getString(ReportField.STACK_TRACE).contains("Context.startForegroundService() did not then call Service.startForeground()");
}
 
Example #3
Source File: AppCenterCollector.java    From J2ME-Loader with Apache License 2.0 4 votes vote down vote up
@Override
public void collect(@NonNull Context context, @NonNull CoreConfiguration config,
					@NonNull ReportBuilder reportBuilder, @NonNull CrashReportData crashReportData) {
	String log = createCrashLog(crashReportData, reportBuilder.getException());
	crashReportData.put(APPCENTER_LOG, log);
}