多多色-多人伦交性欧美在线观看-多人伦精品一区二区三区视频-多色视频-免费黄色视屏网站-免费黄色在线

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > php開源 > 綜合技術 > [置頂] 安卓崩潰信息收集框架ACRA

[置頂] 安卓崩潰信息收集框架ACRA

來源:程序員人生   發布時間:2017-02-14 09:10:45 閱讀次數:4910次

簡介

ACRA is a library enabling Android Application to automatically post their crash reports to a GoogleDoc form. It is targetted to android applications developers to help them get data from their applications when they crash or behave erroneously.
ACRA is used in 2.68% (See AppBrain/stats) of all apps on Google Play as of Feb 2016. That’s over 53K apps using ACRA. And since the average US user has 41 apps installed on their phone that means there is a 70% chance that ACRA is running on any phone. That means ACRA is running on over a billion devices.


ACRA是1個自動搜集崩潰日志到谷歌表單的庫。它幫助安卓開發者在他們程序崩潰或運行毛病時獲得異常數據。
截止2016年2月,ACRA在google play中使用率占2.68%。這意味著有53K款app使用了ACRA。由于美國用戶平均有41的利用程序安裝在手機上,意味著ACRA在每臺手機上運行的幾率為70%。這意味著運行著ACRA的裝備超過10億臺。

  • ACRA是1個開源的Android平臺程序崩潰信息搜集小程序,可以嵌入到Android Project中,當該程序崩潰的時候ACRA能夠在進程完全結束前搜集崩潰狀態時的該利用和裝備的各種信息,發送到搭建好的服務端,便于開發者進行程序毛病信息的搜集,開發者可以更好的改進程序提高兼容性。

  • 官網 http://www.acra.ch/

  • 開源地址 https://github.com/ACRA/acra
  • 文檔 https://github.com/ACRA/acra/wiki/BasicSetup

ACRA成績

這里寫圖片描述
這里寫圖片描述

初衷

  • 官方文檔為純英文版,并且描寫其實不是1下子就可以看懂。特別是自定義發送數據到指定服務器。特測試并記錄。
  • 網上資料沒有自定義數據轉化為表的情勢,手動創建了對應數據的表,方便錄入數據。
  • 后端數據庫已處理好,可以直接使用。
  • 演示工程已可以直接使用。

客戶端配置

  • crash 以toast情勢彈出

    //發送到服務器,Toast情勢
    @ReportsCrashes(formUri = "http://192.168.1.160/AcraServiceDemo/CrashApiAction",
    //formUriBasicAuthLogin = "yourlogin", // optional
    //formUriBasicAuthPassword = "y0uRpa$$w0rd", // optional
     mode = ReportingInteractionMode.TOAST,
     reportType= HttpSender.Type.JSON,//配置以json情勢發送
     resToastText=R.string.crash_toast_text)//配置異常時彈出的信息
    
  • 對話框情勢情勢,會提示用戶輸入上報信息。

    @ReportsCrashes(formUri = "http://192.168.1.160/AcraServiceDemo/CrashApiAction",
            mode = ReportingInteractionMode.DIALOG,
            resToastText = R.string.crash_toast_text2, // optional, displayed as soon as the crash occurs, before collecting data which can take a few seconds
            resDialogText = R.string.crash_dialog_text,
            resDialogIcon = android.R.drawable.ic_dialog_info, //optional. default is a warning sign
            resDialogTitle = R.string.crash_dialog_title, // optional. default is your application name
            resDialogCommentPrompt = R.string.crash_dialog_comment_prompt, // optional. When defined, adds a user text field input with this text resource as a label
            resDialogOkToast = R.string.crash_dialog_ok_toast, // optional. displays a Toast message when the user accepts to send a report.
            resDialogTheme = R.style.AppTheme_Dialog, //optional. default is Theme.Dialog
            reportType = HttpSender.Type.JSON//配置以json情勢發送
           )
    
  • 通知欄情勢,點擊變成對話框情勢

    // 發送到服務器,通知欄情勢,點擊跳進對話框情勢搜集用戶輸入的信息,會提示用戶輸入上報信息。官方已不再提倡使用:This is a legacy feature, as Dialog mode is generally preferred.
    @ReportsCrashes(formUri = "http://192.168.1.160/AcraServiceDemo/CrashApiAction",
           mode = ReportingInteractionMode.NOTIFICATION,
            resToastText = R.string.crash_toast_text2, // optional, displayed as soon as the crash occurs, before collecting data which can take a few seconds
            resDialogText = R.string.crash_dialog_text,
            resDialogIcon = android.R.drawable.ic_dialog_info, //optional. default is a warning sign
            resDialogTitle = R.string.crash_dialog_title, // optional. default is your application name
            resDialogCommentPrompt = R.string.crash_dialog_comment_prompt, // optional. When defined, adds a user text field input with this text resource as a label
            resDialogOkToast = R.string.crash_dialog_ok_toast, // optional. displays a Toast message when the user accepts to send a report.
            resDialogTheme = R.style.AppTheme_Dialog, //optional. default is Theme.Dialog
            resNotifTickerText = R.string.crash_notif_ticker_text,
            resNotifTitle = R.string.crash_notif_title,
            resNotifText = R.string.crash_notif_text,
            resNotifIcon = android.R.drawable.stat_notify_error, // optional. default is a warning sign
            reportType = HttpSender.Type.JSON//配置以json情勢發送
    )
    
  • 發送郵箱,注意:該操作觸發時會調起用戶客戶端郵箱需要用戶主動發送。不建議使用。

    @ReportsCrashes(mailTo = "414850132@qq.com",
            customReportContent = {ReportField.APP_VERSION_CODE, ReportField.APP_VERSION_NAME,
                    ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL, ReportField.CUSTOM_DATA,
                    ReportField.STACK_TRACE, ReportField.LOGCAT},//發送的字段
            mode = ReportingInteractionMode.TOAST,//異常時彈出信息的類型
            resToastText = R.string.crash_toast_text)//彈出的文字
    

服務端配置

// Control
public void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    request.setCharacterEncoding("UTF⑻");
    response.setContentType("text/html; charset=UTF⑻");
    response.getWriter().print("begin");
    ServletInputStream inputStream = request.getInputStream();
    String str = IOUtils.toString(inputStream, "UTF⑻");//json情勢接收
    System.out.println(str);
    System.out.println("開始解析");
    processModel(str);
}

數據庫信息搜集

這里寫圖片描述
這里寫圖片描述

demo代碼

  • 客戶端多種模式配置
    • Toast(可選),然后發送crash到數據庫
    • Dialog,然后發送到服務器(需要用戶提交信息,并且手動同意)。
    • 通知欄提示,然后顯示Dialog,然后發送到服務器(需要用戶提交信息,并且手動同意)。
    • 郵箱情勢發送到指定郵箱
  • 服務端

    • 解析數據為成指定對象
    • 保存到數據庫
  • TODO:圖形化界面分析崩潰信息

  • 工程代碼:https://github.com/scsfwgy/Acra4CustomService

生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 一本大道香蕉高清久久 | 视频免费视频观看网站 | 一级毛片在线免费视频 | 欧美在线看欧美视频免费网站 | 天堂最新版www在线观看 | 国产精品国产三级国产爱网 | 欧美精品videosfree720 | 美国一级毛片片aa成人 | 巨大欧美黑人xxxxbbbb | 久爱免费观看在线精品 | 自拍视频一区二区 | 精品国产中文一级毛片在线看 | xxx性日本| 亚洲校园春色小说 | 亚洲国产精品激情在线观看 | 亚洲成人免费 | 波多野结衣中文字幕在线视频 | 99久久999久久久综合精品涩 | 欧美成人另类 | 国产精品热久久毛片 | 亚洲天堂在线视频 | 91福利在线看 | 欧美在线视频二区 | 亚洲第一成年网 | 黄色毛片视频网站 | 99精品国产在这里白浆 | 午夜免费视频网站 | 国产欧美综合在线 | 亚洲日韩中文字幕在线播放 | 国产精品久久久久久久 | 最近中文字幕无吗高清网 | 羞羞网址 | 俄罗斯freexxxx性 | 一二三四免费观看在线视频6+1 | 一级毛片免费毛片毛片 | 亚洲精品久久久久中文字幕一区 | 久久久久久久久久久观看 | 久久精品网址 | 吃奶跟添下面特舒服 | 久久乐国产精品亚洲综合18 | 国产成人精品视频一区二区不卡 |