Google sending me wrong Intent. Sending C2DM message sends device com.google.android.c2dm.intent.REGISTER

723 views
Skip to first unread message

Paul Pucciarelli

unread,
Apr 1, 2012, 7:42:03 PM4/1/12
to android-c2dm
I am desperate.

Everything about my C2DM setup seems to be fine. I can register
devices, and authorize my server correctly. Sending a message to a
device registrationId yields a status code of 200 and a messageId -
both indications that the message was sent fine.

However my C2DMBroadcastReceiver is receiving an intent of
com.google.android.c2dm.intent.REGISTER which includes the extra
EXTRA_UNREGISTERED. I never receive an intent of type
com.google.android.c2dm.intent.RECEIVE - any message instead sends the
device a REGISTER intent, indicating the device has been unregistered.

Why is Google deciding to unregister the device everytime I attempt to
send a message to it?

Everything seems to work; I cannot look inside the black box between a
seemingly fine POST to https://android.apis.google.com/c2dm/send , and
then the consequent intent broadcast.

Any guidance here would be greatly appreciated.

Paul Pucciarelli

unread,
Apr 1, 2012, 11:05:50 PM4/1/12
to android-c2dm
To elaborate on the problem... when the RECEIVE intent comes in... it
seems to get CANCELLED for some reason:

04-01 22:23:18.100: W/GTalkService(1589): [DataMsgMgr] broadcast
intent callback: result=CANCELLED forIntent
{ act=com.google.android.c2dm.intent.RECEIVE cat=[co.sample] (has
extras) }
04-01 22:23:18.100: W/GTalkService(1589): Receiver package not found,
unregister application co.samplesender samp...@gmail.com

I think C2DM's response to having it's RECEIVE intent cancelled is to
immediately UNREGISTER the device.


On Apr 1, 7:42 pm, Paul Pucciarelli <paul.pucciare...@gmail.com>
wrote:
> seemingly fine POST tohttps://android.apis.google.com/c2dm/send, and

Jim Turner

unread,
Apr 2, 2012, 1:16:58 PM4/2/12
to androi...@googlegroups.com
can you post your Manifest.xml?

Paul Pucciarelli

unread,
Apr 2, 2012, 8:54:43 PM4/2/12
to android-c2dm
Issue has been resolved. It was an issue in manifest. I ruled out
Manifest after checking it 20x, and because it was copy pasted from a
tutorial, and everything else was working. The name in my <uses-
permission android:name="co.sample.permission.C2D_MESSAGE" /> did not
match the declared permission.

If any hapless soul finds this while searching a problem - be advised
that many parts of C2DM can work - it is not an indication of a
correct Manifest. In my case registration worked fine, and I simply
did not receive the RECEIVE intents. I believe because my device was
not accepting the RECEIVE intent, Google was then unregistering - and
thus I would get a REGISTRATION intent when I expected a RECEIVE
intent.



On Apr 2, 1:16 pm, Jim Turner <thursdayn...@gmail.com> wrote:
> can you post your Manifest.xml?
>
> On Sun, Apr 1, 2012 at 8:05 PM, Paul Pucciarelli <paul.pucciare...@gmail.com
>
>
>
>
>
>
>
> > wrote:
> > To elaborate on the problem... when the RECEIVE intent comes in... it
> > seems to get CANCELLED for some reason:
>
> > 04-01 22:23:18.100: W/GTalkService(1589): [DataMsgMgr] broadcast
> > intent callback: result=CANCELLED forIntent
> > { act=com.google.android.c2dm.intent.RECEIVE cat=[co.sample] (has
> > extras) }
> > 04-01 22:23:18.100: W/GTalkService(1589): Receiver package not found,
> > unregister application co.samplesender sampl...@gmail.com

Murali

unread,
Apr 18, 2012, 4:45:00 AM4/18/12
to android-c2dm
Hi, Seems like my problem is similar that of yours. I am able to
receive the REGISTRATION intent but failing to get the RECEIVE intent.
Could you please help me what I need to edit in my manifest file.

On Apr 3, 3:54 am, Paul Pucciarelli <paul.pucciare...@gmail.com>
wrote:

Murali

unread,
Apr 18, 2012, 6:19:26 AM4/18/12
to android-c2dm
I sorted out the issue! :)

andrew

unread,
Aug 13, 2012, 3:54:12 AM8/13/12
to androi...@googlegroups.com
my problem is similar. i receive the intent, i can take the extras, but in LogCat i receive "08-13 10:47:19.140: W/GTalkService(547): [DataMsgMgr] broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=com.example.c2dmclient (has extras) }" and my notification is ignored:
"08-13 10:47:19.140: E/NotificationService(271): Ignoring notification with icon==0: Notification(pri=0 contentView=com.example.c2dmclient/0x7f030001 vibrate=null sound=null defaults=0x0 flags=0x0 kind=[null])".
Any ideas?

andrew

unread,
Aug 13, 2012, 8:07:11 AM8/13/12
to androi...@googlegroups.com
i solved my problem. i dind't payed attention when creating the notification, and i have put 0 to logo id. this was the cause of both problems.
Reply all
Reply to author
Forward
0 new messages