Android从不同服务器推送
是否可以使用c2dm注册许多不同的服务器来通知用户?
问题是,我的用户将自己托管服务器端,这意味着一个用户将始终从同一服务器获取消息,但几乎所有用户都将拥有自己的服务器。
有谁知道这是否可能,或者我应该开始寻找不同的解决方案?
Is it possible to register many diferent servers to notify users with c2dm?
The ting is, my users will host the serverside on there own, meaning one user will always get the messages from the same server but almost all users will have there own server.
Do anyone know if this is possible, or should i start searching for a diferent solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是可能的,但我不确定您是否愿意这样做。
C2DM 推送使用 Google 帐户发送消息,因此消息可以来自任何服务器。您的应用程序将收到一个注册 ID,并且需要将其发送到向其发送消息的服务器。服务器将需要此 ID 以及 Google 帐户信息来向设备发送 C2DM 消息。
我猜您可能不想这样做,所以我可以推荐一些其他选项:
让用户的服务器将消息发送到您的服务器,服务器将其转发到 C2DM 服务并最终转发到设备。您的应用程序会将您的注册 ID 发送到您的服务器。
-或者-
让用户服务器上的服务器软件向您的服务器请求 Google 客户端登录令牌。您的应用程序必须将注册 ID 发送到您的用户服务器。 //我不知道这是否真的有效,我认为理论上是有效的,但如果谷歌检查IP或带有令牌的东西,它可能不会。
This is possible, but I'm not sure you want to do it.
C2DM push uses a Google Account to send messages, so the messages can originate from any server. Your app will receive a registration id and will need to send it to the server that will send it messages. The server will need this id, as well as the Google account information to send a C2DM message to the device.
I'm guessing you probably don't want to do this, so might I recommend a couple of other options:
Have the user's server send the message to your server, which forwards it to the C2DM service and ultimately the device. Your app will send your registration ID to your server.
-or-
Have the server software on your user's server request a Google ClientLogin Token from your server. Your app will have to send the registration ID to your users server. //I don't know if this will actually work, I think it will in theory, but if Google checks IPs or something with the token it might not.