一、创建google doc form,用于保存错误报告;
1.https://drive.google.com/?authuser=0#my-drive 登录账户;
2.在#my-drive 创建spreadsheets和form并不能拿到formkey,在此提供一个链接方便大家去创建一个可用的form;
https://docs.google.com/spreadsheet/viewform?formkey=dGdTZEFieDRncHZwT3hpWk9icjloeHc6MQ
点击该链接,在弹出的网页中点击submit,成功后在在返回的界面上点击Create my own form
3. 获取formkey,在新建的form页面中点击菜单中的form,选择Embed from in a webpage...,在弹出的窗口中即可拿到formkey
二、https://github.com/ACRA/acra 下载源码 acra-4.5.0RC2
省略拿formkey的步骤,按照https://github.com/ACRA/acra/wiki/BasicSetup配置基本可以集成好可以使用的环境
三、集成后,运行会出现一些错误,在此罗列一下如何修改;
1.发送不成功,出现invalid set cookie attribute;
解决方法:修改文件,HttpRequest 152行增加以下两行
httpClient.getParams().setParameter("http.protocol.single-cookie-header",true);
HttpClientParams.setCookiePolicy( httpClient.getParams(), CookiePolicy.BROWSER_COMPATIBILITY);
response = httpClient.execute(httpRequest, new BasicHttpContext());
2.发送成功,google 服务器会返回如下信息
HttpResponse Content :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"><html><head><meta
http-equiv="Content-type" content="text/html; charset=utf-8">
04-27
17:26:56.790: D/ACRA(25162): <title>****</title>
04-27
17:26:56.790: D/ACRA(25162): <link
href=‘/static/spreadsheets/client/css/627030122-form_response_compiled.css‘
type=‘text/css‘ rel=‘stylesheet‘>
04-27 17:26:56.790: D/ACRA(25162):
<style type="text/css">
04-27 17:26:56.790: D/ACRA(25162):
.ss-logo {background:transparent
url("https://ssl.gstatic.com/docs/spreadsheets/forms/sprites_2.png")
no-repeat}
04-27 17:26:56.790: D/ACRA(25162):
</style></head>
04-27 17:26:56.790: D/ACRA(25162):
<body><div class="ss-container"><div
class="ss-resp-card"><div class="ss-confirmation">android bizcard crash
form</div>
04-27 17:26:56.790: D/ACRA(25162): <div
class="ss-custom-resp">Your response has been recorded.</div>
04-27
17:26:56.790: D/ACRA(25162): <div class="ss-opt-actions">
04-27
17:26:56.790: D/ACRA(25162): </div>
04-27 17:26:56.790: D/ACRA(25162):
<hr class="ss-break">
04-27 17:26:56.790: D/ACRA(25162): <div
class="ss-footer"><div class="ss-footer-txt"><a
class="ss-actions-link"
href="https://docs.google.com/spreadsheet/viewform?formkey=dFBEVDhnOFA2R21nSGhYYXhvUXByYXc6MQ&ifq">別の回答を送信</a>
04-27
17:26:56.790: D/ACRA(25162): |
04-27 17:26:56.790: D/ACRA(25162): <a
class="ss-actions-link"
href="https://docs.google.com/spreadsheet/newform?ref=submitpage">フォームを作成</a></div>
04-27
17:26:56.790: D/ACRA(25162): <a class="ss-logo-link"
href="https://docs.google.com/"><div
class="ss-logo">  
3.如果出现form表单中显示的数据项不正确,没有显示,或者显示的位置不对
解决方法:详见http://blog.dfarooq.com/2012/10/using-google-spreadsheets-as-database.html
要保证form表单源码中定义的输入框id 类似entry.2.single,要和acra-4.5.0RC2源码中保持一致;