Search code examples
androidandroid-c2dm

Android push from different servers


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?


Solution

  • 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.