【发布时间】:2012-03-28 22:25:49
【问题描述】:
我正在尝试弄清楚如何使用 Google Api 访问/编辑 Google 电子表格。 我希望始终与来自许多设备的同一个电子表格建立连接。我有使用 AccountManager 的示例,但我不应该使用用户帐户。有什么好的教程吗? 现在我有以下..对吗?
AccountManager accountManager = AccountManager.get(this); ArrayList googleAccounts = new ArrayList();
// Just for the example, I am using the first google account returned.
Account account = new Account("email@gmail.com", "com.google");
// "wise" = Google Spreadheets
AccountManagerFuture<Bundle> amf = accountManager.getAuthToken(account, "wise", null, this, null, null);
try {
Bundle authTokenBundle = amf.getResult();
String authToken = authTokenBundle.getString(AccountManager.KEY_AUTHTOKEN);
// do something with the token
//InputStream response = sgc.getFeedAsStream(feedUrl, authToken, null, "2.1");
}
catch (Exception e) {
// TODO: handle exception
}
【问题讨论】:
-
我在这里找到了一个很好的例子:code.google.com/p/yetanothercoder希望这可以帮助某人
标签: android api google-api spreadsheet