Registration result intent not returning extras

19 views
Skip to first unread message

android_dev

unread,
Aug 12, 2010, 8:41:05 PM8/12/10
to android-c2dm

registrationIntent.putExtra("app",PendingIntent.getBroadcast(context,
0, new Intent().putExtra("myextra", "blah"),
PendingIntent.FLAG_UPDATE_CURRENT));

The broadcast receiver for com.google.android.c2dm.intent.REGISTRATION
receives the registration result, but the received intent does not
have the extra "myextra" and has only the "registration_id". The
received intent should retain the original extras and why is not given
back?

Pintac

unread,
Aug 13, 2010, 2:37:50 AM8/13/10
to android-c2dm
Yip

If you look at most build in android activity that you startactivity
it looses the extras.

And sometimes you really need to pass something.

android_dev

unread,
Aug 13, 2010, 4:03:22 PM8/13/10
to android-c2dm
The PendingIntent passed to C2DM registration is not working correctly
as expected in Android.

Is it correct that C2DM uses the "app" PendingIntent just to get the
app id and discards all other info like extras, data set in the
original intent? This should be fixed so that the PendingIntent used
here behaves the same way with rest of Android.

debajit

unread,
Aug 13, 2010, 4:41:35 PM8/13/10
to androi...@googlegroups.com
hi android_dev,

the pending intent is only used for registration -- it is not used on any of the messages that your app server sends to your app.  if you want to include extras in the latter, you can do so via data.<key>=<value> params in your send request, as documented in http://code.google.com/android/c2dm/index.html#push.

hope this helps!

thx, debajit

android_dev

unread,
Aug 13, 2010, 5:34:36 PM8/13/10
to android-c2dm
This is not the push message.

This is about including extras in the original intent of the "app"
PendingIntent for the register request so that those extras are
returned in the registration result. I'm not seeing those extras in
the registration result.


On Aug 13, 1:41 pm, debajit <deba...@android.com> wrote:
> hi android_dev,
>
> the pending intent is only used for registration -- it is not used on any of
> the messages that your app server sends to your app.  if you want to include
> extras in the latter, you can do so via data.<key>=<value> params in your
> send request, as documented inhttp://code.google.com/android/c2dm/index.html#push.

Costin Manolache

unread,
Aug 13, 2010, 6:27:31 PM8/13/10
to androi...@googlegroups.com
On Fri, Aug 13, 2010 at 2:34 PM, android_dev <esk...@gmail.com> wrote:
This is not the push message.

This is about including extras in the original intent of the "app"
PendingIntent for the register request so that those extras are
returned in the registration result. I'm not seeing those extras in
the registration result.

Not sure why you need the extras - there are other ways to keep state between before
registration and after registration. If you have a good use case, that can't be solved without
this  - it may be possible to preserve the extras in a future version, but right now 
extras passed when sending the registration intent are not  preserved.

Costin

android_dev

unread,
Aug 13, 2010, 7:14:26 PM8/13/10
to android-c2dm
If an app does a register request each for two different app servers,
how to know that the registration result is for a particular app
server? I want to identify that using the extras that are put.
Register requests can be done one by one but Google may periodically
refresh the registration id. In the case of refresh, how to know that
the refreshed registration id is for a particular app server so that
the app can talk to that app server and update the new registration
id?

Do you have recommendations?

The setData(), setClass() in the intent are discarded as well.


On Aug 13, 3:27 pm, Costin Manolache <cos...@google.com> wrote:

Costin Manolache

unread,
Aug 13, 2010, 8:30:09 PM8/13/10
to androi...@googlegroups.com
On Fri, Aug 13, 2010 at 4:14 PM, android_dev <esk...@gmail.com> wrote:
If an app does a register request each for two different app servers,
how to know that the registration result is for a particular app
server? I want to identify that using the extras that are put.
Register requests can be done one by one but Google may periodically
refresh the registration id. In the case of refresh, how to know that
the refreshed registration id is for a particular app server so that
the app can talk to that app server and update the new registration
id?

Do you have recommendations?

The setData(), setClass() in the intent are discarded as well.


Yes, the registration intent is a new intent, with only the parameters specified in the docs.

An app registering with multiple sender IDs is not supported - if it works, it's probably by accident
and may stop working. 

You can have multiple app servers sending messages to one app - as long as they share the 
sender ID.

Costin
Reply all
Reply to author
Forward
0 new messages