當前位置: 首頁>>代碼示例>>Java>>正文


Java ReportField類代碼示例

本文整理匯總了Java中org.acra.ReportField的典型用法代碼示例。如果您正苦於以下問題:Java ReportField類的具體用法?Java ReportField怎麽用?Java ReportField使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ReportField類屬於org.acra包,在下文中一共展示了ReportField類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: send

import org.acra.ReportField; //導入依賴的package包/類
@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();
  } 
}
 
開發者ID:WorldBank-Transport,項目名稱:RoadLab-Pro,代碼行數:24,代碼來源:HockeySender.java

示例2: send

import org.acra.ReportField; //導入依賴的package包/類
@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();
  } 
}
 
開發者ID:carltonwhitehead,項目名稱:wifi-auto-forget,代碼行數:24,代碼來源:HockeySender.java

示例3: remap

import org.acra.ReportField; //導入依賴的package包/類
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;
	}
 
開發者ID:frigidplanet,項目名稱:droidtowers,代碼行數:18,代碼來源:CrashReporterSave.java

示例4: getReportFields

import org.acra.ReportField; //導入依賴的package包/類
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);
}
 
開發者ID:cheyiliu,項目名稱:test4android,代碼行數:18,代碼來源:CrashReportDataFactory.java

示例5: remap

import org.acra.ReportField; //導入依賴的package包/類
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;
    }
 
開發者ID:cheyiliu,項目名稱:test4android,代碼行數:18,代碼來源:HttpSender.java

示例6: send

import org.acra.ReportField; //導入依賴的package包/類
@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);
    }
}
 
開發者ID:cheyiliu,項目名稱:test4android,代碼行數:26,代碼來源:GoogleFormSender.java

示例7: remap

import org.acra.ReportField; //導入依賴的package包/類
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;
    }
 
開發者ID:cheyiliu,項目名稱:test4android,代碼行數:26,代碼來源:GoogleFormSender.java

示例8: onCreate

import org.acra.ReportField; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:davidgraeff,項目名稱:Android-NetPowerctrl,代碼行數:29,代碼來源:App.java

示例9: buildSubjectBody

import org.acra.ReportField; //導入依賴的package包/類
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()};
}
 
開發者ID:uhuru-mobile,項目名稱:mobile-store,代碼行數:30,代碼來源:CrashReportSender.java

示例10: onCheckedChanged

import org.acra.ReportField; //導入依賴的package包/類
@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);
	}
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:9,代碼來源:DevReportActivity.java

示例11: attachBaseContext

import org.acra.ReportField; //導入依賴的package包/類
@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();
	}
}
 
開發者ID:stuxo,項目名稱:REDAndroid,代碼行數:40,代碼來源:REDApplication.java

示例12: createCrashLog

import org.acra.ReportField; //導入依賴的package包/類
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();
}
 
開發者ID:WorldBank-Transport,項目名稱:RoadLab-Pro,代碼行數:16,代碼來源:HockeySender.java

示例13: buildSubjectBody

import org.acra.ReportField; //導入依賴的package包/類
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()};
}
 
開發者ID:vit1-irk,項目名稱:idec-mobile,代碼行數:29,代碼來源:CrashReportSender.java

示例14: getCustomAcraReportFields

import org.acra.ReportField; //導入依賴的package包/類
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()]);
}
 
開發者ID:zamojski,項目名稱:TowerCollector,代碼行數:9,代碼來源:MyApplication.java

示例15: reportError

import org.acra.ReportField; //導入依賴的package包/類
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);
}
 
開發者ID:proninyaroslav,項目名稱:libretorrent,代碼行數:13,代碼來源:Utils.java


注:本文中的org.acra.ReportField類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。