当前位置: 首页>>代码示例>>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;未经允许,请勿转载。