想要从Android应用A S preadsheet上传到谷歌文档 - 什么是最好的解决方案? [英] Want to upload a spreadsheet from an Android app to Google Docs - what is the best solution?

查看:119
本文介绍了想要从Android应用A S preadsheet上传到谷歌文档 - 什么是最好的解决方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望让我的Andr​​oid应用程序上传A S preadsheet文档谷歌文档。使用简单的URI请求:

I'd like to allow my Android app to upload a spreadsheet document to Google Docs. Using a simple Uri request:

Uri uri = Uri.parse("http://docs.google.com/DocAction?action=updoc&hl=en");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);

和这个页面将出现在手机上为空白(必须使用code不能与手机兼容)。

and this page appears as blank on a phone (must use code not compatible with phones).

我已经调查了谷歌文档程序从Web服务上载。它们需要首先验证用户并检索在以下POST请求(包括AuthSub凭证),以用于实际上传文档一个的AuthSub授权。这是一个Web服务,它可以保证一个URL返回到的AuthSub容易,但是怎么样在手机上?

I've looked into the Google Docs procedures for uploading from a Web Service. They require first authenticating the user and retrieving an AuthSub authorization to be used in a following POST request (including the AuthSub token) to actually upload the doc. This is easy from a Web Service that can guarantee a URL to return the AuthSub to, but how about on a mobile phone?

目前以为我会使用的URLConnection,用getHeader(字符串)抢到的AuthSub,然后动态地构建整个文档是这样的:

Currently thinking that I'll use UrlConnection, use getHeader(String) to grab the AuthSub, then build the entire document dynamically like this:

POST /feeds/default/private/full HTTP/1.1
Host: docs.google.com
GData-Version: 3.0
Authorization: <your authorization header here>
Content-Length: 73612
Slug: test.xls
Content-Type: application/vnd.ms-excel

<?xml version='1.0' encoding='UTF-8'?>
<Worksheet ss:Name="Sheet1">
<Table ss:ExpandedColumnCount="4" ss:ExpandedRowCount="4" x:FullColumns="1" x:FullRows="1">
<Row>
<Cell><Data ss:Type="String">IN</Data></Cell>
<Cell><Data ss:Type="String">OUT</Data></Cell>
<Cell><Data ss:Type="String">TIME</Data></Cell>
<Cell><Data ss:Type="String">SUBTOTAL</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">Value</Data></Cell>
<Cell><Data ss:Type="Number">123</Data></Cell>
<Cell><Data ss:Type="String">Example</Data></Cell>
<Cell><Data ss:Type="String">Example</Data></Cell>
</Row>
</Table>
</Worksheet>

与任何人任何经验或建议 - 很想听听评论

Anyone with any experience or suggestions - would love to hear a comment.

谢谢,

生锈

推荐答案

中的所有必要的信息谷歌文档文档

Found all the info necessary in Google Docs documentation.

HTTP://$c$c.google。 COM /的API /文件/文档/ 3.0 / developers_guide_java.html

这篇关于想要从Android应用A S preadsheet上传到谷歌文档 - 什么是最好的解决方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆