当前位置: 首页>>代码示例>>Java>>正文


Java ReportSenderException类代码示例

本文整理汇总了Java中org.acra.sender.ReportSenderException的典型用法代码示例。如果您正苦于以下问题:Java ReportSenderException类的具体用法?Java ReportSenderException怎么用?Java ReportSenderException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ReportSenderException类属于org.acra.sender包,在下文中一共展示了ReportSenderException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: send

import org.acra.sender.ReportSenderException; //导入依赖的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.sender.ReportSenderException; //导入依赖的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: send

import org.acra.sender.ReportSenderException; //导入依赖的package包/类
@Override
public void send(CrashReportData report) throws ReportSenderException {

	final Map<String, String> finalReport = remap(report);

	try {
		OutputStreamWriter osw = new OutputStreamWriter(crashReport);

		Set<Entry<String, String>> set = finalReport.entrySet();
		Iterator<Entry<String, String>> i = set.iterator();

		while (i.hasNext()) {
			Map.Entry<String, String> me = (Entry<String, String>) i.next();
			osw.write("[" + me.getKey() + "]=" + me.getValue());
		}

		osw.flush();
		osw.close();
	} catch (IOException e) {
		Log.e(TAG, "IO ERROR", e);
	}

}
 
开发者ID:frigidplanet,项目名称:droidtowers,代码行数:24,代码来源:CrashReporterSave.java

示例4: sendCrashReport

import org.acra.sender.ReportSenderException; //导入依赖的package包/类
/**
 * Sends the report with all configured ReportSenders. If at least one
 * sender completed its job, the report is considered as sent and will not
 * be sent again for failing senders.
 * 
 * @param errorContent
 *            Crash data.
 * @throws ReportSenderException
 *             if unable to send the crash report.
 */
private void sendCrashReport(CrashReportData errorContent) throws ReportSenderException {
    if (!ACRA.isDebuggable() || ACRA.getConfig().sendReportsInDevMode()) {
        boolean sentAtLeastOnce = false;
        for (ReportSender sender : reportSenders) {
            try {
                sender.send(errorContent);
                // If at least one sender worked, don't re-send the report
                // later.
                sentAtLeastOnce = true;
            } catch (ReportSenderException e) {
                if (!sentAtLeastOnce) {
                    throw e; // Don't log here because we aren't dealing
                             // with the Exception here.
                } else {
                    Log.w(LOG_TAG,
                            "ReportSender of class "
                                    + sender.getClass().getName()
                                    + " failed but other senders completed their task. ACRA will not send this report again.");
                }
            }
        }
    }
}
 
开发者ID:cheyiliu,项目名称:test4android,代码行数:34,代码来源:SendWorker.java

示例5: send

import org.acra.sender.ReportSenderException; //导入依赖的package包/类
public void send(@NonNull Context context, @NonNull CrashReportData errorContent)
        throws ReportSenderException {
    Intent emailIntent = new Intent("android.intent.action.SENDTO");
    emailIntent.setData(Uri.fromParts("mailto", this.config.mailTo(), (String) null));
    emailIntent.addFlags(268435456);
    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);
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:11,代码来源:CrashReportSender.java

示例6: send

import org.acra.sender.ReportSenderException; //导入依赖的package包/类
public void send(@NonNull Context context, @NonNull CrashReportData errorContent)
        throws ReportSenderException {
    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);
}
 
开发者ID:vit1-irk,项目名称:idec-mobile,代码行数:11,代码来源:CrashReportSender.java

示例7: onCreate

import org.acra.sender.ReportSenderException; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    if (!BuildConfig.DEBUG) {
        ACRA.init(this);
        ACRA.getErrorReporter().addReportSender(new ReportSender() {
            @Override
            public void send(Context context, CrashReportData errorContent) throws ReportSenderException {
                context.getSharedPreferences("crash", MODE_MULTI_PROCESS).edit()
                        .putBoolean("crashed", true).commit();
            }
        });
        ACRA.getErrorReporter().setEnabled(true);
    }
}
 
开发者ID:Kornkammer,项目名称:foodcoapp,代码行数:16,代码来源:FoodcoApplication.java

示例8: send

import org.acra.sender.ReportSenderException; //导入依赖的package包/类
public void send(@NonNull Context context, @NonNull CrashReportData errorContent)
        throws ReportSenderException {
    Intent emailIntent = new Intent("android.intent.action.SENDTO");
    emailIntent.setData(Uri.fromParts("mailto", this.config.mailTo(), (String) 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);
}
 
开发者ID:f-droid,项目名称:fdroidclient,代码行数:11,代码来源:CrashReportSender.java

示例9: send

import org.acra.sender.ReportSenderException; //导入依赖的package包/类
@Override
public void send(Context context, CrashReportData crashReportData) throws ReportSenderException {
    try {
        String rootDirectory = Environment.getExternalStorageDirectory()
            .getAbsolutePath();
        File f = new File(rootDirectory
            + File.separatorChar
            + "osmdroid"
            + File.separatorChar);
        f.mkdirs();
        f = new File(rootDirectory
            + File.separatorChar
            + "osmdroid"
            + File.separatorChar
            + "crash.log");
        if (f.exists())
            f.delete();


        f.createNewFile();
        PrintWriter pw = new PrintWriter(new FileWriter(f));
        pw.println(crashReportData.toString());
        pw.close();
    } catch (Exception exc) {
        exc.printStackTrace();
    }


}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:30,代码来源:OsmApplication.java

示例10: setupACRA

import org.acra.sender.ReportSenderException; //导入依赖的package包/类
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");
	}
}
 
开发者ID:cernekee,项目名称:ics-openconnect,代码行数:35,代码来源:Application.java

示例11: send

import org.acra.sender.ReportSenderException; //导入依赖的package包/类
@Override
public void send(Context context, CrashReportData crashReportData) throws ReportSenderException {
    EmailIntentSender emailSender = new EmailIntentSender(getApplicationContext());
    emailSender.send(context, crashReportData);
}
 
开发者ID:guiying712,项目名称:AndroidModulePattern,代码行数:6,代码来源:MyApplication.java

示例12: send

import org.acra.sender.ReportSenderException; //导入依赖的package包/类
@Override
public void send(Context context, CrashReportData report) throws ReportSenderException {

    try {




        final String reportAsString = report.toJSON().toString();

        HttpSenderService.sendReport(context, formUri, reportAsString, login, password);


    } catch (JSONReportException e) {
        throw new ReportSenderException("Error while sending " + ACRA.getConfig().reportType()
                + " report via Http " + ACRA.getConfig().httpMethod().name(), e);
    }
}
 
开发者ID:andryr,项目名称:Harmony-Music-Player,代码行数:19,代码来源:HttpSender.java

示例13: send

import org.acra.sender.ReportSenderException; //导入依赖的package包/类
@Override
public void send(CrashReportData crashReportData) throws ReportSenderException {
    sendMailReport(crashReportData);
}
 
开发者ID:xiongwei-git,项目名称:TedMemo,代码行数:5,代码来源:CrashReportSender.java

示例14: sendMailReport

import org.acra.sender.ReportSenderException; //导入依赖的package包/类
private void sendMailReport(CrashReportData errorContent) throws ReportSenderException {
    new EmailIntentSender(mContext).send(errorContent);
}
 
开发者ID:xiongwei-git,项目名称:TedMemo,代码行数:4,代码来源:CrashReportSender.java

示例15: send

import org.acra.sender.ReportSenderException; //导入依赖的package包/类
@Override
public void send(CrashReportData errorContent) throws ReportSenderException {
    Log.i("test", "send, " + errorContent);
}
 
开发者ID:cheyiliu,项目名称:test4android,代码行数:5,代码来源:MyReportSender.java


注:本文中的org.acra.sender.ReportSenderException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。