C++ 中的 C2DM NDK
是否可以在 C++ 中从 Android NDK 注册并接收 C2DM 消息?
Google 网站上的所有 C2DM 示例均来自 Java SDK。我检查了 NDK 文档,没有发现 C2DM 的提及。
我比较确定没有办法做到这一点。有谁知道不同吗?
Is it possible to register and receive C2DM messages from the Android NDK in C++?
All the C2DM examples on Google's site are from the Java SDK. I checked through the NDK docs and could find no mention of C2DM.
I am relatively certain there is no way to do this. Does anyone know differently?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不完全是。 C2DM 的接收端需要实现为派生自 BroadcastReceiver 并在清单中列出的 Java 类。 AFAIK,你不能完全在 NDK 中创建一个全新的 Java 类 - 你需要一个 Java 文件,即使它只有
native
方法声明。从这里开始,就是重写 BroadcastReceiver 方法的问题 - 主要是
onReceive()
。你可以在 NDK 中做到这一点。而且您很可能找不到任何示例。
Not entirely. The receiving end for C2DM needs to be implemented as a Java class that derives from BroadcastReceiver and is listed in the manifest. AFAIK, you cannot create a brand new Java class entirely in NDK - you need a Java file, even if it has nothing but
native
method declarations.From there, it's a matter of overriding BroadcastReceiver methods - primarily
onReceive()
. That you can do in NDK.And you won't, most likely, find any examples.