Coder Social home page Coder Social logo

kzganesan / android-crash Goto Github PK

View Code? Open in Web Editor NEW

This project forked from msdx/android-crash

0.0 2.0 0.0 1.41 MB

android程序崩溃异常处理框架

Home Page: http://blog.csdn.net/maosidiaoxian/article/details/27320815

License: Apache License 2.0

Java 100.00%

android-crash's Introduction

android-crash

android crash 是我写的一个Android程序崩溃信息处理框架。通过它,可以在程序崩溃时收集崩溃信息并用你指定的方式发送出来。

在本框架中,我实现了邮件及HTTP POST请求的发送方式。如果要采用其他方式,可以继承AbstractCrashReportHandler类并实现其抽象方法。

使用本框架的方法只需要两个步骤。 1、添加依赖: 在repository中添加jcenter。

repository {
   jcenter() // or mavenCentral()
}

在dependencies中添加如下依赖。

compile(group: 'com.githang', name: 'android-crash', version: '0.2.2')

2、写一个类,继承自Application,并在AndroidManifest.xml中指定。然后在onCreate方法中添加如下代码:

客户端发送E-mail方式(需要添加activation.jar, additionnal.jar, mail.jar 这三个jar包,可以从本项目的libs文件夹中获取)

    CrashEmailReport report = new CrashEmailReport(this);
    report.setReceiver("[email protected]");
    report.setSender("[email protected]");
    report.setSendPassword("xxxxxxxx");
    report.setHost("smtp.163.com");
    report.setPort("465");
    report.start();

Http post请求的方式:

	CrashHttpReport report = new CrashHttpReport(this);
	report.setUrl("http://crashreport.jd-app.com/ReportFile");
	report.setTo("[email protected]");
	report.setToParam("to");
	report.setTitleParam("subject");
	report.setBodyParam("message");
	report.setFileParam("fileName");
	report.setCallback(new CrashHttpReport.HttpReportCallback() {
            @Override
            boolean isSuccess(int i, String s) {
                return s.endsWith("ok")
            }
        });
	report.start();

android-crash's People

Contributors

msdx avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.