问题标签 [google-api-java-client]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
2198 浏览

google-api-java-client - 在android中引入-google-places-api示例的问题

我正在尝试通过 Google APIs Client 将 Google Places API 用于 Android 应用程序。我找到了这个例子:http ://ddewaele.blogspot.com/2011/05/introducing-google-places-api.html并且像java应用程序一样启动运行正常,所以我必须有一个正确的API KEY。我正在使用 eclipse 和 maven,一切似乎都很好,但是当应用程序像 Android 应用程序一样启动时,模拟器运行正常但显示以下错误:应用程序应用程序名称 (com.ecs.googleplaces.sample.Main) 已意外停止. 请再试一次。我已经看到了为 Android HTTP 请求创建 Google HTTP 传输对象的答案,并且我已经编写了所有依赖项(以及更多,以及一些较新版本的依赖项)我的 LogCat 中有一个粘贴:

谁能帮我?谢谢

0 投票
1 回答
1231 浏览

android - 如何在 Android 上使用 google-api-java-client API 获取 CalendarEntry 的描述?

我在 Android 上使用适用于 Java 的 Google API 客户端库来检索公共 Google 日历条目:

http://code.google.com/p/google-api-java-client/

我能够让 Android 日历示例正常工作:

http://samples.google-api-java-client.googlecode.com/hg/calendar-v2-atom-android-sample/instructions.html

我制作了一个示例 Android 应用程序,它可以很好地提取公共 Google 日历。CalendarEntry 类具有“标题”和“摘要”字段。在我的测试中,“标题”字段包含事件的名称,“摘要”字段包含存储在 Google 服务器上的位置和时间数据。

您如何获取存储在 Google 服务器上的条目描述(不仅仅是条目名称、时间和地点)?

0 投票
1 回答
804 浏览

android - google-api-java-client for Google Calendar on Android Infinite loop

I have been struggling with the sample android application provided by Google for integrating some Google calendar functionality found here at Google code.

I've modified the original code just a tad. Specifically, in the CalendarAndroidSample.java class at line 326 I've modified:

to now compute:

This fills the listview with all of the events in my calendar just fine.

The infinite loop occurs whenever I add an event to my google calendar. Once a new event is added, the sample app freezes up, and looking at the DDMS I can see the logcat spitting out this repeatedly without an end:

The only way that I've found to stop the app from looping is to delete the calendar event. Once the calendar event is deleted, the app comes back to life and lists my events, BUT, the listview now contains all of my events, repeated over and over again. It's like the feed never stops.

My best guess is that at line 333, where the code reads:

nextLink never becomes null, thus creating the loop. But why does this happen ONLY when I add a calendar event?

EDIT:

I deleted some calendar events and it started working. It seems as though if the calendar has more than 25 events, it starts to loop? What is the meaning of this?!

0 投票
1 回答
513 浏览

android - 在 android 中使用 Google-API-Java-Client 检索 Google 日历中的所有事件详细信息(位置、描述等)

我一直在尝试使用 android 中的 Google-API-Java-Client 在 Google 日历中获取事件的详细信息,例如位置详细信息、描述、开始时间和结束时间等。

我正在使用以下示例代码

http://code.google.com/p/google-api-java-client/source/browse?repo=samples#hg%2Fcalendar-v2-atom-android-sample

0 投票
1 回答
347 浏览

android - 在 Android 中通过 google-java-api 访问非默认日历事件

我希望我们的应用用户能够访问他们 Google 日历中的非默认日历事件。我们可以很好地访问他们默认日历中的事件,但我们也希望包括其他日历中的事件。我在谷歌支持论坛上发现了一个帖子,上面写着:

“要从另一个日历获取提要,您必须在 URL 中指定其 ID。其他日历的 ID(= 主/默认日历除外),您必须转到日历设置部分(查看标题为“我的日历”在屏幕的左侧),点击“设置”,然后点击你的另一个日历的链接。然后,滚动到页面底部,并复制/粘贴你通过点击获得的 URL “私人地址”行上的橙色“XML”按钮。

有一个更好的方法吗?我真的必须让我们的应用程序用户按照这些程序手动输入他们的非默认 Google 日历的 URL,以便我们可以检索它们吗?我们正在使用 google-api-java-client 访问用户 Google 日历。

0 投票
1 回答
1131 浏览

android - Android 上 Google 日历 API 中的重复事件

我已经开始使用 Google Calendar Api,现在我可以进行身份​​验证、获取日历列表、重命名日历以及将具有指定时间和标题的事件添加到选定的日历。

我已经开始使用calendar-v2-atom-android-sample中的模型,并且我想出了我必须为事件添加到模型中的内容,因为我在 Google Apps API 上的 Android 应用程序中读取了访问事件数据

但是现在我必须添加一个重复事件,在阅读了 CreatingRecurring之后,我不清楚public class Recurrence {}. 这是如何实现的,我应该如何定义 setRecurrence(Recurrence recurr)()函数。

0 投票
2 回答
2763 浏览

android - “需要 411 长度” - 来自 Google Docs Api 使用 Android API 10 及更低版本的响应

我正在为 Android 设备开发一个应用程序,其中一部分是启用用户 Google Docs 和设备存储之间的下载和上传。我遇到的问题是我在不同版本的 Android API 之间得到了不同的行为。我一直在 API lvl 10 (Android 2.3.3) 上进行大部分开发。虚拟设备上没有问题(我没有使用此 API lvl 或更高级别测试的真实设备)。在 API lvl 8 (2.2.x) 及以下的设备和模拟器上,当请求启动可恢复的上传会话时,我遇到了来自 Google Docs Api 的 411 Length required 错误。在 API lvl 10 的模拟器上运行相同的应用程序时不会发生这种情况。

我正在使用 Eclipse 进行开发,并使用 Google API Java Client 1.4.1-beta 与 Docs Api 进行通信。我为 Google Docs API 遵循的文档在这里:http ://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html

根据上述文档,启动可恢复的上传会话是发送一个空的 POST 请求。对于用户 Google Docs 的“根”,地址是“ https://docs.google.com/feeds/upload/create-session/default/private/full ”。这就是我为(空体)请求设置标头的方式:

我还应该提到,我用于 HTTP 的库如下:

我做了一些数据包嗅探以实际看到标头,你瞧,在不同版本的 Android 上,标头实际上设置的方式不同。如果您注意到,默认情况下应该使用 https 发送请求,因此我将其更改为使用 http 来查看数据包的标头。结果如下:

使用 Android API lvl 10 的模拟器:

使用 API lvl 7 的模拟器:

注意缺少内容长度标头,情况也不同。这解释了为什么我得到 411 响应,但是如何解决这个问题?显然,我的目标是在所有设备上获得相同的行为(由于与此问题无关的原因,不包括具有 Android 1.x 的设备),最好不使用特定于版本的代码。

老实说,我想不出可以在我的代码中应用的许多合适的解决方案。我唯一能想到的:

使用 API 中的(已弃用)方法以不同方式设置标头,但无济于事。请求中的实际标头仍然相同。

使用“0”或 Integer.toString(0) 设置属性也没有什么区别(显然,我在这里有点绝望)。

因此,非常欢迎任何旨在寻找解决方案的帮助或建议。如果特别要求,我将提供更多代码,并且可以通过数据包嗅探来测试不同的解决方案。这也很有可能是 Google Api Java 客户端或 Android 中的错误。但是哪一个?如果没有找到解决方案,我对 Android 的了解不够深入,无法弄清楚在哪里报告这个(疑似)错误。因此,如果您怀疑罪魁祸首确实不是我的代码,那么请分享您对哪个组件导致标题以不同方式设置的想法。

编辑 - 算法要求堆栈跟踪,这里是: http: //pastebin.com/yDCCLB2P

编辑 - 我正在为内容设置一个 mimetype,尽管正文是空的。我尝试删除内容类型标头,没有任何改进。该行现在在上面的代码中被注释掉了。

编辑 - 我一直在尝试解决这个问题。这是尝试在同一代码中以两种不同方式设置标头时的堆栈跟踪:http: //pastebin.com/NkmFjYB3

当同时使用时,它们会相互碰撞。删除任何一个都将产生与以前类似的结果(Docs 中需要 411 长度,并且在请求中不存在 content-length)。使用其中一种方式和不推荐使用的方式( transport.defaultHeaders.contentLength = "0"; )创建请求时,不会发生冲突(或不会出现在堆栈跟踪中)。使用上述任何方法的任意组合,要么存在双标头冲突,要么请求没有内容长度。

0 投票
1 回答
960 浏览

java - 使用 Google API Java 客户端将数据库上传到 Google 电子表格

在我开始之前,我想得到一些反馈。我有兴趣让我的 Android 应用程序将我的 SQLite 数据库上传到 Google 电子表格。我从几个人那里得到了一些不同的反馈,所以我想确保我朝着正确的方向前进。

我应该使用Google API Java Client,或者更具体地说是Google Documents List API创建电子表格,然后使用 Google Spreadsheet API 在电子表格中添加和编辑数据。这是我正在做的正确方法吗?如果是这样,您是否知道一些有用的示例代码?

我真的很感谢有人在这件事上的指导。如果我的问题中的某些内容不清楚,请询问。

干杯,乔治

0 投票
2 回答
1154 浏览

android - 带有android的谷歌日历api - 删除事件

我想使用以下代码从日历中删除一个事件:

怎么了?

我开始从这个“基础”(calendar-v2-atom-oauth-sample)构建我的模型: http://code.google.com/p/google-api-java-client/source/browse/? repo=samples#hg%2Fcalendar-v2-atom-oauth-sample%2Fsrc%2Fcom%2Fgoogle%2Fapi%2Fclient%2Fsample%2Fcalendar%2Fv2%2Fmodel

0 投票
1 回答
1054 浏览

android - 在 Eclipse 中使用来自 android 的 google 客户端 api 的注释 - @Key

我正在尝试使用 google api 从 android 访问 picasa。我正在关注一个通过以下方式解析 atom 的示例:

AlbumFeed 提要 = request.execute().parseAs(AlbumFeed.class);

为了使原子解析器工作,我知道我需要定义具有 @Key 注释的类,例如:

但是eclipse甚至没有编译这个 - 我不断得到: Key cannot be resolved as a type and The attribute value is undefined for the annotation type Key

我知道您可以在项目的 Eclipse 中定义注释,但我认为您需要一些处理类。

非常感谢任何帮助 - 让 eclipse 编译它以便我可以解析 Atom 有效负载的步骤是什么?

编译后,我知道如果我使用 proguard,我需要添加 -keepattributes Annotation ,Signature 。真的吗?还有其他陷阱吗?