Google App Engine (GAE)、Urban Airship、Java、推送通知。示例代码?
我的服务器在 GAE (Java) 上运行,我使用 Urban Airship 服务来发送推送通知。当然,当我使用他们的网络界面发送测试通知时,一切正常,但我想向我的 GAE 应用程序/服务器添加一个测试按钮,以便它触发 UA 发送推动。
问题是,到目前为止我看到的所有示例都不能针对 GAE 的 Java 库进行编译。
有没有人有任何 java 示例代码,他们想分享该构建和构建?在 GAE 下运行以通过 Urban Airship 触发推送通知?
谢谢!
My server is running on GAE (Java), and I'm using Urban Airship service to deliver push notifications. Of course, everything works fine when I use their web-interface to send a test notification, but I'd like to add a test-button to my GAE app/server to have it trigger UA to send the push.
The problem is, all of the examples I've seen so far don't compile against GAE's Java libraries.
Does anyone have any java sample code they'd like to share that build & runs under GAE to trigger a push notification through Urban Airship?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
以下是一些在 GAE 下工作并通过 Urban Airship 发送推送通知的 Java 示例代码:
希望这会有所帮助!
Here is some Java sample code that works under GAE and sends a push notification through Urban Airship:
Hope this helps!
以防万一有人尝试使用 Google 应用引擎通过 Urbanairship 向 iOS 设备发送推送通知,这最终对我有用!这是针对 V3 API 的。
导入 org.apache.commons.codec.binary.Base64; //commons-codec-1.6.jar
Just in case anyone is trying to use Google app engine to send push notification via urbanairship, to iOS devices, this is what finally worked for me! This is for V3 API.
import org.apache.commons.codec.binary.Base64; //commons-codec-1.6.jar
因为您说城市飞艇不是必需的,所以我推荐
java-apns-gae
。它是一个开源 Java APNS 库,专门设计用于在 Google App Engine 上工作(和使用)。
https://github.com/ZsoltSafrany/java-apns-gae
Because you said Urban Airship isn't a requirement let me recommend
java-apns-gae
.It's an open-source Java APNS library that was specifically designed to work (and be used) on Google App Engine.
https://github.com/ZsoltSafrany/java-apns-gae
urbanairship4j(可通过 Google 代码获取)使用 Google HTTP Java 客户端 因此可以在 AppEngine、Android 等上完美运行。
urbanairship4j (available on Google Code) uses Google HTTP Java Client so works perfectly on AppEngine, Android, etc.