Java Code Examples for org.acra.ReportField

The following are top voted examples for showing how to use org.acra.ReportField. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: RoadLab-Pro   File: HockeySender.java   View source code 6 votes vote down vote up
@Override
public void send(CrashReportData report) throws ReportSenderException {
  String log = createCrashLog(report);
  String url = BASE_URL + ACRA.getConfig().formKey() + CRASHES_PATH;

  try {
    DefaultHttpClient httpClient = new DefaultHttpClient(); 
    HttpPost httpPost = new HttpPost(url);

    List<NameValuePair> parameters = new ArrayList<NameValuePair>(); 
    parameters.add(new BasicNameValuePair("raw", log));
    parameters.add(new BasicNameValuePair("userID", report.get(ReportField.INSTALLATION_ID)));
    parameters.add(new BasicNameValuePair("contact", report.get(ReportField.USER_EMAIL)));
    parameters.add(new BasicNameValuePair("description", report.get(ReportField.USER_COMMENT)));
    
    httpPost.setEntity(new UrlEncodedFormEntity(parameters, HTTP.UTF_8));

    httpClient.execute(httpPost);   
  }
  catch (Exception e) {
    e.printStackTrace();
  } 
}
 
Example 2
Project: wifi-auto-forget   File: HockeySender.java   View source code 6 votes vote down vote up
@Override
public void send(CrashReportData report) throws ReportSenderException {
  String log = createCrashLog(report);
  String url = BASE_URL + ACRA.getConfig().formKey() + CRASHES_PATH;
 
  try {
    DefaultHttpClient httpClient = new DefaultHttpClient(); 
    HttpPost httpPost = new HttpPost(url);
 
    List<NameValuePair> parameters = new ArrayList<NameValuePair>(); 
    parameters.add(new BasicNameValuePair("raw", log));
    parameters.add(new BasicNameValuePair("userID", report.get(ReportField.INSTALLATION_ID)));
    parameters.add(new BasicNameValuePair("contact", report.get(ReportField.USER_EMAIL)));
    parameters.add(new BasicNameValuePair("description", report.get(ReportField.USER_COMMENT)));
    
    httpPost.setEntity(new UrlEncodedFormEntity(parameters, HTTP.UTF_8));
 
    httpClient.execute(httpPost);   
  }
  catch (Exception e) {
    e.printStackTrace();
  } 
}
 
Example 3
Project: droidtowers   File: CrashReporterSave.java   View source code 6 votes vote down vote up
private Map<String, String> remap(Map<ReportField, String> report) {

		ReportField[] fields = ACRA.getConfig().customReportContent();
		if (fields.length == 0) {
			fields = ACRAConstants.DEFAULT_REPORT_FIELDS;
		}

		final Map<String, String> finalReport = new HashMap<String, String>(report.size());
		for (ReportField field : fields) {
			if (mMapping == null || mMapping.get(field) == null) {
				finalReport.put(field.toString(), report.get(field));
			} else {
				finalReport.put(mMapping.get(field), report.get(field));
			}
		}
		return finalReport;
	}
 
Example 4
Project: test4android   File: CrashReportDataFactory.java   View source code 6 votes vote down vote up
private List<ReportField> getReportFields() {
    final ReportsCrashes config = ACRA.getConfig();
    final ReportField[] customReportFields = config.customReportContent();

    final ReportField[] fieldsList;
    if (customReportFields.length != 0) {
        Log.d(LOG_TAG, "Using custom Report Fields");
        fieldsList = customReportFields;
    } else if (config.mailTo() == null || "".equals(config.mailTo())) {
        Log.d(LOG_TAG, "Using default Report Fields");
        fieldsList = ACRAConstants.DEFAULT_REPORT_FIELDS;
    } else {
        Log.d(LOG_TAG, "Using default Mail Report Fields");
        fieldsList = ACRAConstants.DEFAULT_MAIL_REPORT_FIELDS;
    }
    return Arrays.asList(fieldsList);
}
 
Example 5
Project: test4android   File: HttpSender.java   View source code 6 votes vote down vote up
private Map<String, String> remap(Map<ReportField, String> report) {

        ReportField[] fields = ACRA.getConfig().customReportContent();
        if (fields.length == 0) {
            fields = ACRAConstants.DEFAULT_REPORT_FIELDS;
        }

        final Map<String, String> finalReport = new HashMap<String, String>(report.size());
        for (ReportField field : fields) {
            if (mMapping == null || mMapping.get(field) == null) {
                finalReport.put(field.toString(), report.get(field));
            } else {
                finalReport.put(mMapping.get(field), report.get(field));
            }
        }
        return finalReport;
    }
 
Example 6
Project: test4android   File: GoogleFormSender.java   View source code 6 votes vote down vote up
@Override
public void send(CrashReportData report) throws ReportSenderException {
    Uri formUri = mFormUri == null ? Uri.parse(String.format(ACRA.getConfig().googleFormUrlFormat(), ACRA
            .getConfig().formKey())) : mFormUri;
    final Map<String, String> formParams = remap(report);
    // values observed in the GoogleDocs original html form
    formParams.put("pageNumber", "0");
    formParams.put("backupCache", "");
    formParams.put("submit", "Envoyer");

    try {
        final URL reportUrl = new URL(formUri.toString());
        Log.d(LOG_TAG, "Sending report " + report.get(ReportField.REPORT_ID));
        Log.d(LOG_TAG, "Connect to " + reportUrl);

        final HttpRequest request = new HttpRequest();
        request.setConnectionTimeOut(ACRA.getConfig().connectionTimeout());
        request.setSocketTimeOut(ACRA.getConfig().socketTimeout());
        request.setMaxNrRetries(ACRA.getConfig().maxNumberOfRequestRetries());
        request.send(reportUrl, Method.POST, HttpRequest.getParamsAsFormString(formParams), Type.FORM);

    } catch (IOException e) {
        throw new ReportSenderException("Error while sending report to Google Form.", e);
    }
}
 
Example 7
Project: test4android   File: GoogleFormSender.java   View source code 6 votes vote down vote up
private Map<String, String> remap(Map<ReportField, String> report) {

        ReportField[] fields = ACRA.getConfig().customReportContent();
        if (fields.length == 0) {
            fields = ACRAConstants.DEFAULT_REPORT_FIELDS;
        }

        int inputId = 0;
        final Map<String, String> result = new HashMap<String, String>();
        for (ReportField originalKey : fields) {
            switch (originalKey) {
            case APP_VERSION_NAME:
                result.put("entry." + inputId + ".single", "'" + report.get(originalKey));
                break;
            case ANDROID_VERSION:
                result.put("entry." + inputId + ".single", "'" + report.get(originalKey));
                break;
            default:
                result.put("entry." + inputId + ".single", report.get(originalKey));
                break;
            }
            inputId++;
        }
        return result;
    }
 
Example 8
Project: Android-NetPowerctrl   File: App.java   View source code 6 votes vote down vote up
/**
 * We do not do any loading or starting when the application is loaded.
 * This can be requested by using useService()
 */
@Override
public void onCreate() {
    super.onCreate();
    LoadStoreIconData.onCreate(this);

    ACRAConfiguration config = ACRA.getNewDefaultConfig(this);
    config.setFormUri(getString(R.string.acralyzer_http_url));
    config.setFormUriBasicAuthLogin(getString(R.string.acralyzer_http_login));
    config.setFormUriBasicAuthPassword(getString(R.string.acralyzer_http_pwd));
    config.setReportType(HttpSender.Type.JSON);
    config.setResToastText(R.string.crash_toast_text);
    config.setBuildConfigClass(BuildConfig.class);
    try {
        config.setMode(ReportingInteractionMode.TOAST);
    } catch (ACRAConfigurationException e) {
        e.printStackTrace();
    }
    config.setCustomReportContent(new ReportField[]{ReportField.REPORT_ID, ReportField.APP_VERSION_CODE, ReportField.APP_VERSION_NAME, ReportField.PACKAGE_NAME, ReportField.PHONE_MODEL, ReportField.ANDROID_VERSION, ReportField.BUILD, ReportField.BRAND, ReportField.PRODUCT, ReportField.TOTAL_MEM_SIZE, ReportField.AVAILABLE_MEM_SIZE, ReportField.CUSTOM_DATA, ReportField.STACK_TRACE, ReportField.USER_COMMENT, ReportField.USER_APP_START_DATE, ReportField.USER_CRASH_DATE, ReportField.USER_EMAIL, ReportField.IS_SILENT, ReportField.DEVICE_FEATURES, ReportField.SHARED_PREFERENCES, ReportField.THREAD_DETAILS});
    ACRA.setConfig(config);
    ACRA.init(this);

    lifecycleHandler = new LifecycleHandler();
    registerActivityLifecycleCallbacks(lifecycleHandler);
}
 
Example 9
Project: mobile-store   File: CrashReportSender.java   View source code 5 votes vote down vote up
private String[] buildSubjectBody(Context context, CrashReportData errorContent) {
    ImmutableSet fields = this.config.getReportFields();
    if (fields.isEmpty()) {
        fields = new ImmutableSet<ReportField>(ACRAConstants.DEFAULT_MAIL_REPORT_FIELDS);
    }

    String subject = context.getPackageName() + " Crash Report";
    StringBuilder builder = new StringBuilder();
    Iterator var4 = fields.iterator();

    while (var4.hasNext()) {
        ReportField field = (ReportField) var4.next();
        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 10
Project: Nird2   File: DevReportActivity.java   View source code 5 votes vote down vote up
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
	ReportField field = (ReportField) buttonView.getTag();
	if (field != null) {
		if (isChecked) excludedFields.remove(field);
		else excludedFields.add(field);
	}
}
 
Example 11
Project: Nird2   File: DevReportActivity.java   View source code 5 votes vote down vote up
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
	ReportField field = (ReportField) buttonView.getTag();
	if (field != null) {
		if (isChecked) excludedFields.remove(field);
		else excludedFields.add(field);
	}
}
 
Example 12
Project: REDAndroid   File: REDApplication.java   View source code 5 votes vote down vote up
@Override
protected void attachBaseContext(Context base) {
	super.attachBaseContext(base);

	final ACRAConfiguration config;
	try {
		config = new ConfigurationBuilder(this)
                   .setCustomReportContent(
                   		ReportField.REPORT_ID,
                   		ReportField.APP_VERSION_CODE,
                   		ReportField.APP_VERSION_NAME,
                   		ReportField.PHONE_MODEL,
                   		ReportField.ANDROID_VERSION,
                   		ReportField.BUILD,
                   		ReportField.BRAND,
                   		ReportField.PRODUCT,
                   		ReportField.TOTAL_MEM_SIZE,
                   		ReportField.AVAILABLE_MEM_SIZE,
                   		ReportField.BUILD_CONFIG,
                   		ReportField.STACK_TRACE,
                   		ReportField.STACK_TRACE_HASH,
                   		ReportField.DISPLAY,
                   		ReportField.USER_COMMENT,
                   		ReportField.USER_APP_START_DATE,
                   		ReportField.USER_CRASH_DATE,
                   		ReportField.DUMPSYS_MEMINFO,
                   		ReportField.INSTALLATION_ID,
                   		ReportField.DEVICE_FEATURES,
                   		ReportField.SETTINGS_SYSTEM,
                   		ReportField.SETTINGS_GLOBAL,
                   		ReportField.THREAD_DETAILS
				)
                   .build();

		ACRA.init(this, config);
	} catch (ACRAConfigurationException e) {
		e.printStackTrace();
	}
}
 
Example 13
Project: RoadLab-Pro   File: HockeySender.java   View source code 5 votes vote down vote up
private String createCrashLog(CrashReportData report) {
  Date now = new Date();
  StringBuilder log = new StringBuilder();
  
  log.append("Package: " + report.get(ReportField.PACKAGE_NAME) + "\n");
  log.append("Version: " + report.get(ReportField.APP_VERSION_CODE) + "\n");
  log.append("Android: " + report.get(ReportField.ANDROID_VERSION) + "\n");
  log.append("Manufacturer: " + android.os.Build.MANUFACTURER + "\n");
  log.append("Log: " + report.get(ReportField.LOGCAT) + "\n");
  log.append("Date: " + now + "\n");
  log.append("\n");
  log.append(report.get(ReportField.STACK_TRACE));

  return log.toString();
}
 
Example 14
Project: idec-mobile   File: CrashReportSender.java   View source code 5 votes vote down vote up
private String[] buildSubjectBody(Context context, CrashReportData errorContent) {
    ImmutableSet fields = this.config.getReportFields();
    if (fields.isEmpty()) {
        fields = new ImmutableSet<>(ACRAConstants.DEFAULT_MAIL_REPORT_FIELDS);
    }

    String subject = context.getPackageName() + " Crash Report";
    StringBuilder builder = new StringBuilder();

    for (Object field1 : fields) {
        ReportField field = (ReportField) field1;
        builder.append(field.toString()).append('=');
        builder.append(errorContent.get(field));
        builder.append('\n');
        if ("STACK_TRACE".equals(field.toString())) {
            String stackTrace = errorContent.get(field).toString();
            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 15
Project: TowerCollector   File: MyApplication.java   View source code 5 votes vote down vote up
private ReportField[] getCustomAcraReportFields() {
    List<ReportField> customizedFields = new ArrayList<ReportField>(Arrays.asList(ACRAConstants.DEFAULT_REPORT_FIELDS));
    // remove Device ID to make sure it will not be included in report
    customizedFields.remove(ReportField.DEVICE_ID);
    // remove BuildConfig to avoid leakage of configuration data in report
    customizedFields.remove(ReportField.BUILD_CONFIG);
    return customizedFields.toArray(new ReportField[customizedFields.size()]);
}
 
Example 16
Project: libretorrent   File: Utils.java   View source code 5 votes vote down vote up
public static void reportError(Throwable error, String comment)
{
    if (error == null) {
        return;
    }

    if (comment != null) {
        ACRA.getErrorReporter().putCustomData(ReportField.USER_COMMENT.toString(), comment);
    }

    ACRA.getErrorReporter().handleSilentException(error);
}
 
Example 17
Project: droidtowers   File: DroidTowersAndroidApplication.java   View source code 5 votes vote down vote up
@Override
public void onCreate() {

	/*
	 * The following line triggers the initialization of ACRA 
	 * ACRA is used to help with debug logs etc.
	 */

	ACRA.init(this);
	ACRA.getErrorReporter().setReportSender(new CrashReporterSave(this));

	ACRAConfiguration conf = ACRA.getNewDefaultConfig(this);
	try {
		conf.setCustomReportContent(new ReportField[] { DISPLAY, USER_COMMENT, USER_EMAIL, TOTAL_MEM_SIZE, AVAILABLE_MEM_SIZE });
		conf.setResDialogCommentPrompt(R.string.crash_dialog_comment_prompt);
		conf.setResToastText(R.string.crash_toast_text);
		conf.setResDialogText(R.string.crash_dialog_text);
		conf.setResDialogEmailPrompt(R.string.crash_dialog_email_prompt);
		conf.setResDialogTitle(R.string.crash_dialog_title);
		conf.setResDialogOkToast(R.string.crash_dialog_ok_toast);
		conf.setMode(ReportingInteractionMode.DIALOG);
	} catch (ACRAConfigurationException e) {
		e.printStackTrace();
	}

	ACRA.setConfig(conf);

	// Have to call this to continue loading Android
	super.onCreate();
}
 
Example 18
Project: fdroidclient   File: CrashReportSender.java   View source code 5 votes vote down vote up
private String[] buildSubjectBody(Context context, CrashReportData errorContent) {
    ImmutableSet fields = this.config.getReportFields();
    if (fields.isEmpty()) {
        fields = new ImmutableSet<ReportField>(ACRAConstants.DEFAULT_MAIL_REPORT_FIELDS);
    }

    String subject = context.getPackageName() + " Crash Report";
    StringBuilder builder = new StringBuilder();
    Iterator var4 = fields.iterator();

    while (var4.hasNext()) {
        ReportField field = (ReportField) var4.next();
        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 19
Project: test4android   File: EmailIntentSender.java   View source code 5 votes vote down vote up
private String buildBody(CrashReportData errorContent) {
    ReportField[] fields = ACRA.getConfig().customReportContent();
    if(fields.length == 0) {
        fields = ACRAConstants.DEFAULT_MAIL_REPORT_FIELDS;
    }

    final StringBuilder builder = new StringBuilder();
    for (ReportField field : fields) {
        builder.append(field.toString()).append("=");
        builder.append(errorContent.get(field));
        builder.append('\n');
    }
    return builder.toString();
}
 
Example 20
Project: ics-openconnect   File: Application.java   View source code 5 votes vote down vote up
private void setupACRA() {
	String hax0rPackages[] = { "com.koushikdutta.superuser",
			"com.noshufou.android.su",
			"com.noshufou.android.su.elite",
			"com.miui.uac",
			"eu.chainfire.supersu",
			"eu.chainfire.supersu.pro",
			"de.robv.android.xposed.installer",
			"biz.bokhorst.xprivacy",
			"biz.bokhorst.xprivacy.pro" };

	ACRA.init(this);

	ErrorReporter er = ACRA.getErrorReporter();
	er.setReportSender(
			new HttpSender(org.acra.sender.HttpSender.Method.PUT,
							org.acra.sender.HttpSender.Type.JSON,
							null) {

				@Override
				public void send(CrashReportData report) throws ReportSenderException {
					report.put(ReportField.APPLICATION_LOG, VPNLog.dumpLast());
					super.send(report);
				}

			});

	for (String s : hax0rPackages) {
		// FIXME: ACRA does not properly escape key strings
		// https://github.com/ACRA/acra/issues/90
		er.putCustomData("pkg-" + s.replaceAll("\\.",  "-"),
				isPackageInstalled(s) ? "true" : "false");
	}
}
 
Example 21
Project: Yarrn   File: Report.java   View source code 5 votes vote down vote up
public Report(CrashReportData crashReportData, ReportField[] tags) {

        // Set time of crash
        if (crashReportData.containsKey(ReportField.USER_CRASH_DATE)) {
            String crashDate = crashReportData.getProperty(ReportField.USER_CRASH_DATE);
            setCrashReportTimestamp(crashDate);
        }

        // Set report ID
        if (crashReportData.containsKey(ReportField.REPORT_ID)) {
            this.setEventId(crashReportData.getProperty(ReportField.REPORT_ID));
        }

        put(SENTRY_PLATFORM, "android");

        if (tags != null) {
            HashMap<String, String> tagsMap = new HashMap<String, String>();

            for (ReportField field : tags) {
                if (!crashReportData.containsKey(field)) {
                    continue;
                }

                tagsMap.put(field.toString(), crashReportData.getProperty(field));
            }

            setTags(tagsMap);
        }
    }
 
Example 22
Project: acra-sentry-sender   File: Report.java   View source code 5 votes vote down vote up
public Report(CrashReportData crashReportData, ReportField[] tags) {

        // Set time of crash
        if (crashReportData.containsKey(ReportField.USER_CRASH_DATE)) {
            String crashDate = crashReportData.getProperty(ReportField.USER_CRASH_DATE);
            setCrashReportTimestamp(crashDate);
        }

        // Set report ID
        if (crashReportData.containsKey(ReportField.REPORT_ID)) {
            this.setEventId(crashReportData.getProperty(ReportField.REPORT_ID));
        }

        put(SENTRY_PLATFORM, "android");

        if (tags != null) {
            HashMap<String, String>tagsMap = new HashMap<String, String>();

            for (ReportField field : tags) {
                if (!crashReportData.containsKey(field)) {
                    continue;
                }

                tagsMap.put(field.toString(), crashReportData.getProperty(field));
            }

            setTags(tagsMap);
        }
    }
 
Example 23
Project: test4android   File: CrashReportData.java   View source code 4 votes vote down vote up
/**
 * Constructs a new {@code Properties} object.
 */
public CrashReportData() {
    super(ReportField.class);
}
 
Example 24
Project: Impeller   File: JiraReportSender.java   View source code 4 votes vote down vote up
private String generateDescription(CrashReportData reportData) {
    StringBuilder sb = new StringBuilder();

    sb.append("This is an automated bug report. A summary is given here and detailed data is contained in attatchments.\n\n");
    appendLine(sb, "App Package Name:", reportData.getProperty(ReportField.PACKAGE_NAME));
    appendLine(sb, "App Version Code:", reportData.getProperty(ReportField.APP_VERSION_CODE));
    appendLine(sb, "App Version Name:", reportData.getProperty(ReportField.APP_VERSION_NAME));
    sb.append(EOL);

    appendLine(sb, "Stack Trace:", code(reportData.getProperty(ReportField.STACK_TRACE)));

    String logcat = reportData.getProperty(ReportField.LOGCAT);
    if (!Strings.isNullOrEmpty(logcat)) {
        appendLine(sb, "logcat output:", quote(logcat));
    }

    appendLine(sb, "Display:", quote(reportData.getProperty(ReportField.DISPLAY)));

    long availableMemSize = Long.parseLong(reportData.getProperty(ReportField.AVAILABLE_MEM_SIZE));
    long totalMemSize = Long.parseLong(reportData.getProperty(ReportField.TOTAL_MEM_SIZE));
    sb.append(bold("Hard Disk Space:"));
    sb.append(availableMemSize / BYTES_PER_MEGABYTE);
    sb.append("MB avaliable out of ");
    sb.append(totalMemSize / BYTES_PER_MEGABYTE);
    sb.append("MB total").append(EOL);

    appendLine(sb, "App Private Files Path:", reportData.getProperty(ReportField.FILE_PATH));

    // sb.append(bold("App Running Time:"));
    // Duration duration = new Duration(userAppStartDate, userCrashDate);
    // sb.append(duration.toPeriod().toString(ISOPeriodFormat.alternateExtended()));
    // sb.append(" (");
    // sb.append(userAppStartDate.toString(ISODateTimeFormat.dateTimeNoMillis()));
    // sb.append(" - ");
    // sb.append(userCrashDate.toString(ISODateTimeFormat.dateTimeNoMillis()));
    // sb.append(")\n");

    // So acra puts in a N/A into this field when it was not provided.
    // Because, you know, it likes wasting space...
    String userEmail = reportData.getProperty(ReportField.USER_EMAIL);
    if (!Strings.isNullOrEmpty(userEmail) && !userEmail.equals("N/A")) {
        appendLine(sb, "User Email:", userEmail);
    }

    String dumpSysMemInfo = reportData.getProperty(ReportField.DUMPSYS_MEMINFO);
    if (!Strings.isNullOrEmpty(dumpSysMemInfo)) {
        sb.append('\n');
        appendLine(sb, "System Memory Information:", noformat(dumpSysMemInfo));
    }

    return sb.toString();
}
 
Example 25
Project: Android-NetPowerctrl   File: App.java   View source code 4 votes vote down vote up
public static void setErrorReportContentCrash() {
    ACRAConfiguration config = ACRA.getConfig();
    config.setCustomReportContent(new ReportField[]{ReportField.REPORT_ID, ReportField.APP_VERSION_CODE, ReportField.APP_VERSION_NAME, ReportField.PACKAGE_NAME, ReportField.PHONE_MODEL, ReportField.ANDROID_VERSION, ReportField.BUILD, ReportField.BRAND, ReportField.PRODUCT, ReportField.TOTAL_MEM_SIZE, ReportField.AVAILABLE_MEM_SIZE, ReportField.CUSTOM_DATA, ReportField.STACK_TRACE, ReportField.USER_COMMENT, ReportField.USER_APP_START_DATE, ReportField.USER_CRASH_DATE, ReportField.USER_EMAIL, ReportField.IS_SILENT, ReportField.DEVICE_FEATURES, ReportField.SHARED_PREFERENCES, ReportField.THREAD_DETAILS});
    ACRA.setConfig(config);
}
 
Example 26
Project: Android-NetPowerctrl   File: App.java   View source code 4 votes vote down vote up
public static void setErrorReportContentMessage() {
    ACRAConfiguration config = ACRA.getConfig();
    config.setCustomReportContent(new ReportField[]{ReportField.REPORT_ID, ReportField.APP_VERSION_CODE, ReportField.APP_VERSION_NAME, ReportField.PACKAGE_NAME, ReportField.PHONE_MODEL, ReportField.ANDROID_VERSION, ReportField.BUILD, ReportField.BRAND, ReportField.PRODUCT, ReportField.TOTAL_MEM_SIZE, ReportField.AVAILABLE_MEM_SIZE, ReportField.CUSTOM_DATA, ReportField.USER_COMMENT, ReportField.USER_APP_START_DATE, ReportField.USER_CRASH_DATE, ReportField.USER_EMAIL, ReportField.IS_SILENT, ReportField.DEVICE_FEATURES, ReportField.SHARED_PREFERENCES, ReportField.THREAD_DETAILS});
    ACRA.setConfig(config);
}
 
Example 27
Project: Android-NetPowerctrl   File: App.java   View source code 4 votes vote down vote up
public static void setErrorReportContentLogFile(String filename) {
    ACRAConfiguration config = ACRA.getConfig();
    config.setApplicationLogFile(filename);
    config.setCustomReportContent(new ReportField[]{ReportField.REPORT_ID, ReportField.APP_VERSION_CODE, ReportField.APP_VERSION_NAME, ReportField.PACKAGE_NAME, ReportField.PHONE_MODEL, ReportField.ANDROID_VERSION, ReportField.BUILD, ReportField.BRAND, ReportField.PRODUCT, ReportField.CUSTOM_DATA, ReportField.APPLICATION_LOG, ReportField.USER_COMMENT, ReportField.USER_APP_START_DATE, ReportField.USER_EMAIL, ReportField.DEVICE_FEATURES, ReportField.SHARED_PREFERENCES});
    ACRA.setConfig(config);
}
 
Example 28
Project: test4android   File: HttpSender.java   View source code 3 votes vote down vote up
/**
 * <p>
 * Create a new HttpSender instance with its destination taken from
 * {@link ACRA#getConfig()} dynamically. Configuration changes to the
 * formUri are applied automatically.
 * </p>
 * 
 * @param method
 *            HTTP {@link Method} to be used to send data. Currently only
 *            {@link Method#POST} and {@link Method#PUT} are available. If
 *            {@link Method#PUT} is used, the {@link ReportField#REPORT_ID}
 *            is appended to the formUri to be compliant with RESTful APIs.
 * 
 * @param type
 *            {@link Type} of encoding used to send the report body.
 *            {@link Type#FORM} is a simple Key/Value pairs list as defined
 *            by the application/x-www-form-urlencoded mime type.
 * 
 * @param mapping
 *            Applies only to {@link Method#POST} method parameter. If null,
 *            POST parameters will be named with {@link ReportField} values
 *            converted to String with .toString(). If not null, POST
 *            parameters will be named with the result of
 *            mapping.get(ReportField.SOME_FIELD);
 */
public HttpSender(Method method, Type type, Map<ReportField, String> mapping) {
    mMethod = method;
    mFormUri = null;
    mMapping = mapping;
    mType = type;
    mUsername = null;
    mPassword = null;
}
 
Example 29
Project: test4android   File: HttpSender.java   View source code 3 votes vote down vote up
/**
 * <p>
 * Create a new HttpPostSender instance with a fixed destination provided as
 * a parameter. Configuration changes to the formUri are not applied.
 * </p>
 * 
 * @param method
 *            HTTP {@link Method} to be used to send data. Currently only
 *            {@link Method#POST} and {@link Method#PUT} are available. If
 *            {@link Method#PUT} is used, the {@link ReportField#REPORT_ID}
 *            is appended to the formUri to be compliant with RESTful APIs.
 * 
 * @param type
 *            {@link Type} of encoding used to send the report body.
 *            {@link Type#FORM} is a simple Key/Value pairs list as defined
 *            by the application/x-www-form-urlencoded mime type.
 * @param formUri
 *            The URL of your server-side crash report collection script.
 * @param mapping
 *            Applies only to {@link Method#POST} method parameter. If null,
 *            POST parameters will be named with {@link ReportField} values
 *            converted to String with .toString(). If not null, POST
 *            parameters will be named with the result of
 *            mapping.get(ReportField.SOME_FIELD);
 */
public HttpSender(Method method, Type type, String formUri, Map<ReportField, String> mapping) {
    mMethod = method;
    mFormUri = Uri.parse(formUri);
    mMapping = mapping;
    mType = type;
    mUsername = null;
    mPassword = null;        
}
 
Example 30
Project: test4android   File: CrashReportData.java   View source code 2 votes vote down vote up
/**
 * Returns the property with the specified name.
 * 
 * @param key the name of the property to find.
 * @return the named property value, or {@code null} if it can't be found.
 */
public String getProperty(ReportField key) {
    return super.get(key);
}