下载gdata-src.java-1.41.1.zip,然后写make文件,将它们一起放到android\frameworks\base\core\java\com\google\android\文件夹下面,然后编译android工程。有风险,需要的时间很长。
1. 我用eclipse去编译这份源代码,发现缺失了不少google.common的源文件,需要补齐。
2. android的gdata和google的gdata不完全相同,还需要看一下两者的结构差别才可以去弄,涉及修改gdata的源代码。没有Port过这部分的东西,不能完全帮忙到你了。
1. 我用eclipse去编译这份源代码,发现缺失了不少google.common的源文件,需要补齐。
2. android的gdata和google的gdata不完全相同,还需要看一下两者的结构差别才可以去弄,涉及修改gdata的源代码。没有Port过这部分的东西,不能完全帮忙到你了。
解决方案 »
- ListView上的按钮 怎么知道它是在哪个列表项上的
- 请教安卓游戏问题。?
- 一个DroidDraw与AnDroidDraw的问题?
- 怎样在android中实现和java me中playTone一样的功能
- 周二去文思创新笔试android,希望给点建议!
- socket server端无法捕获异常:recvfrom fail :ETIMEDOUT
- videoview在线播放优酷M3U8视频,暂停不好用,暂停之后还会自动开始
- 新人提问,关于.so文件调用另一个.so的问题
- 应用退出后,应用后台服务还开着。如何关闭?
- 大家讲讲app的技术架构
- 100分请教高手两个make文件的问题
- 请教一下,如何利用获取网页上的特定信息。
可以先试试将gdata-sample.java-1.41.1.zip中的jar包放到里面,直接编译试试。
下面是登陆请求的详细介绍 (可以跳过去不看)ClientLogin can be used with any application that can make an HTTPS POST request. The POST request should be structured as a form post with the default encoding application/x-www-form-urlencoded. Parameters should be included in the body of the post. Action URL parameter: https://www.google.com/accounts/ClientLoginParameter Description
accountType Type of account to request authorization for. Possible values are:GOOGLE (get authorization for a Google account only)
HOSTED (get authorization for a hosted account only)
HOSTED_OR_GOOGLE (get authorization first for a hosted account; if attempt fails, get authorization for a Google account)Use HOSTED_OR_GOOGLE if you're not sure which type of account you want authorization for. If the user information matches both a hosted and a Google account, only the hosted account is authorized.
Email User's full email address. It must include the domain (i.e. [email protected]).
Passwd
User's password.
service Name of the Google service you're requesting authorization for. Each service using the Authorization service is assigned a name value; for example, the name associated with Google Calendar is 'cl'. This parameter is required when accessing services based on Google Data APIs. For specific service names, refer to the service documentation.
source Short string identifying your application, for logging purposes. This string should take the form:
"companyName-applicationName-versionID".
logintoken (optional) Token representing the specific CAPTCHA challenge. Google supplies this token and the CAPTCHA image URL in a login failed response with the error code "CaptchaRequired".
logincaptcha (optional) String entered by the user as an answer to a CAPTCHA challenge 从这里开始 问题 ????????????????????????????????????其中 service :
Name of the Google service you're requesting authorization for. Each service using the Authorization service is assigned a name value; for example, the name associated with Google Calendar is 'cl'. This parameter is required when accessing services based on Google Data APIs. For specific service names, refer to the service documentation. google docs 的service name是什么 ? 是 “writely”吗?这句是我在另一个地方找到的
The service name for Documents is writely.
http://code.google.com/intl/zh-CN/apis/documents/faq_gdata.html#clientlogin
HttpClient httpclient = new DefaultHttpClient();
//你的URL
HttpPost httppost = new HttpPost("https://www.google.com/accounts/ClientLogin");
HttpResponse response;能够得到 Auth
String uriAPI = "https://docs.google.com/feeds/default/private/full";
/*建立HTTP Get对象*/
HttpGet httpRequest = new HttpGet(uriAPI);
try
{
// GoogleLogin auth= Authorization
httpRequest.addHeader("GoogleLogin auth", auth);
/*发送请求并等待响应*/
HttpResponse httpResponse = new DefaultHttpClient().execute(httpRequest);
/*若状态码为200 ok*/
if(httpResponse.getStatusLine().getStatusCode() == HttpStatus.SC_OK)
{
/*读*/
String strResult = EntityUtils.toString(httpResponse.getEntity());
/*去没有用的字符*/
//strResult = eregi_replace("(\r\n|\r|\n|\n\r)","",strResult);
view_suggest.setText(strResult);
}但是得到bad request我还试过 httpRequest.addHeader("Authorization", auth); 也是得到 400 bad requestauth = "GoogleLogin auth=" + auth;
httpRequest.addHeader("Authorization", auth);
得到 ssl handshake failure:I/O error during system call, unknown error:0这个 sll handshake failure 和 400 bad request 哪一个更接近正确的请求?????????
http://code.google.com/intl/zh-CN/apis/documents/docs/2.0/developers_guide_protocol.html
上面发错了,这个是登陆的建立文档
http://code.google.com/intl/zh-CN/apis/accounts/docs/AuthForInstalledApps.htmlauth的语句起码是这样的:
https://www.google.com/accounts/AuthSubRequest?scope=http%3A%2F%2Fdocs.google.com%2Ffeeds%2F&session=1&secure=0&next=http%3A%2F%2Fwww.example.com%2Fwelcome.html你的auth写得不对。
http://code.google.com/intl/zh-CN/apis/accounts/docs/AuthForInstalledApps.html
我就是根据这个写得请求 获得auth
这是请求的样本
POST /accounts/ClientLogin HTTP/1.0
Content-type: application/x-www-form-urlencodedaccountType=HOSTED_OR_GOOGLE&[email protected]&Passwd=north23AZ&service=cl&
source=Gulp-CalGulp-1.05
这是返回的格式
HTTP/1.0 200 OK
Server: GFE/1.3
Content-Type: text/plain SID=DQAAAGgA...7Zg8CTN
LSID=DQAAAGsA...lk8BBbG
Auth=DQAAAGgA...dk3fA5N
auth的语句起码是这样的:
https://www.google.com/accounts/AuthSubRequest?scope=http%3A%2F%2Fdocs.google.com%2Ffeeds%2F&session=1&secure=0&next=http%3A%2F%2Fwww.example.com%2Fwelcome.html这个地方我是 clientlogin吧 不是web application
AuthSub for Web Applications
我的意思是 我是客户端的登录不是通过网页登录的
POST /accounts/ClientLogin HTTP/1.0
Content-type: application/x-www-form-urlencodedaccountType=HOSTED_OR_GOOGLE&[email protected]&Passwd=north23AZ&service=cl&
source=Gulp-CalGulp-1.05这些做成一个url。
另外我想你既然自己去实现登录了,何不去LINUX\android\frameworks\base\core\java\com\google\android\gdata\client下面看看android是如何登录google的账户的,或许比看文档更有用呢。
我就是按照这个做的登录请求 能够等到Auth但是得到Auth后往下做时 请求出问题