Search code examples
androidandroid-c2dm

C2DM: Can I register for multiple sender-ids in the same app?


I have an app that manages a list of third-party servers and can poll them for information. These servers are supposed to be independent from each other (and potentially not under my control).

Now I want to implement c2dm notifications to avoid constant active polling. The third-party servers will be able to publish their senderId and allow my client to send them the C2DM registrationId after registering with google.

Now my question: is it possible to register from the same application package for multiple c2dm senders? And if so, how would I distinguish the registration (and especially the unregistration) processes from each other, so that I can update the correct local server configuration entry?

The only resource I found was this google groups thread, but it hasn't been answered for a while. I hope you can help.

Note: This is only about the registration. When sending the messages, the third-party servers can inject their server name, so the message handler can distinguish them. But the registration process with google's servers doesn't seem to give me an option of passing back user defined information to my BroadcastReceiver


Solution

  • This could be related: http://groups.google.com/group/android-c2dm/browse_frm/thread/e2095d79c80de4c1/37325b1b1e5ec1e1?lnk=gst&q=multiple#37325b1b1e5ec1e1

    Written by Costin Manolache (Software Engineer at Google ):

    An app can't register 2 different sender IDs - there is a single record for an (android-id + app id), the second registration will replace the first one and the first sender won't be able to send.

    In any case - this is not a 'supported' feature right now, but sounds reasonable.

    Please don't use one sender account shared with multiple customers - besides TOS you may run into other problems.

    I'm having the same problem. A client has multiple accounts with multiple servers and shall register with all the servers it has accounts for to receive notifications.