Google App Engine Java和Android入门

reu*_*b87 5 java google-app-engine android google-cloud-messaging

我一直在努力让这个例子从下面运行:

https://developers.google.com/eclipse/docs/getting_started

我遇到的第一个问题是没有在Android SDK中安装"Google Cloud Messaging for Android Library"(显然我知道).

但是现在我在Android项目的两个文件中遇到了自动生成代码的问题:GCMIntentService.java和RegisterActivity.java

错误是:

  • 方法getDeviceInfo(String)未定义类型Deviceinfoendpoint GCMIntentService.java
  • 对于MessageEndpoint RegisterActivity.java类型,未定义方法listMessages()
  • 方法insertDeviceInfo(DeviceInfo)未定义类型Deviceinfoendpoint GCMIntentService.java
  • 方法removeDeviceInfo(String)未定义类型Deviceinfoendpoint GCMIntentService.java

我在Ubuntu上使用Java SDK v1.7.0_15,但我也尝试使用Java SDK v1.6的Windows 7并且遇到了同样的问题.最新的Android平台4.2.2和Google App Engine 1.7.7.Eclipse是Juno Service Release 2.

问题看起来他们正在做一些错误,因为在Deviceinfoendpoint内部有一个方法getDeviceInfo用于内部类DeviceInfoEndpoint(不同的capatilisations).

我可以尝试修复它,但只是想知道我的设置是否有问题要发生这种情况?

任何帮助,将不胜感激.

Hei*_*igo 3

在 GCMIntentService.java 类中,在有错误的行中的端点对象后面添加 .deviceInfoEndpoint(),如下所示:

DeviceInfo existingInfo = endpoint.getDeviceInfo(registration)
DeviceInfo existingInfo = endpoint.deviceInfoEndpoint().getDeviceInfo(registration)
Run Code Online (Sandbox Code Playgroud)

在 RegisterActivity.java 中更改行

messageEndpoint.listMessages().setLimit(5).execute();
Run Code Online (Sandbox Code Playgroud)

messageEndpoint.messageEndpoint().listMessages().setLimit(5).execute();
Run Code Online (Sandbox Code Playgroud)