1

The Android C2DM push app that I have developed has the reference of my sender is (example: "sender@gmail.com") in the application side code. Case 1: When I install this app on a Android device, the device has a gmail id as "personalid@gmail.com" in Accounts and Sync settings. App is registered successfully with C2DM but it does not receive any of the pushed messages.

Case2: When I use the same sender id ("sender@gmail.com") in the Android device's Accounts and Sync. I receive all the messages that I push.

Why case 1 is failing and case 2 (sender id all through) is successful?

Zuliox
  • 11
  • 1
  • 3
  • 1
    that sounds weird and should not be the case - I also do not see such a behaviour in my apps - can you show your manifest? – ligi May 08 '12 at 10:50

2 Answers2

0

Please make sure that you have signed out from built in gtalk application of your phone, if you are not signed out from gtalk app, then it will create ambiguity in between gtalk and ur personal app for messaged pushed from google server so it can not send message to any app and give exception.

For detailed information of push notification , please check https://developers.google.com/android/c2dm/

best c2dm tutorialis ,http://www.vogella.com/articles/AndroidCloudToDeviceMessaging/article.html

Chirag_CID
  • 2,224
  • 1
  • 24
  • 33
0

This is the way that C2DM works. It makes sense that it works in this way since it requires the email address for both the registration id and authentication token.

When sending a push message, your third party server uses the registration id built on (probably) "sender@gmail.com", and authentication token built on the same email. Google's server looks on your device and tries to find that specific email address account. You can have multiple accounts on the device, but at least one of them has to be the account used to register the device.

Why would Google ask for the email anyway if it wouldn't have mattered? It would have been much easier to use directly the device's unique id.

Raul Rene
  • 10,014
  • 9
  • 53
  • 75
  • 1
    Yes, that is what I have observed. My observation is, as a developer of the App - I need to hard code my gmail id (now this is sender@gmail.com id) in the app. When a user installs my App on his device, he has already been using his personalid@gmail.com for his Android device. To say, functioning of my app has no dependency on the personalid of the user (personalid is only for maintaining persistence presence with Android App Store). Therefore I have to hard code my senderid in the App to make a push notification work on the device. Is my understanding correct? – Zuliox May 10 '12 at 04:39
  • 1
    No. He doesn't need YOUR email in order to use C2DM. You can let him use his email to register on the device, but this would also require him to also "register" on the server, in order to get an authentication token with the same email. Then the communication can be established. I know that Google asks for your gmail account when registering on the c2dm page, but I don't think it imposes using 1 unique address for each application. There are applications that use C2DM and work successfully for more than 1 email. – Raul Rene May 10 '12 at 06:47