General questions regarding C2DM implementation

202 views
Skip to first unread message

cmolson

unread,
Sep 20, 2010, 9:22:37 PM9/20/10
to android-c2dm
Hi Guys, I have setup a working project (Web server that registerd
with google as a sender, and client app that can receive messages and
act on them) It is working great so far. I have a few questions
though:

1) I may have misunderstood but from what I understand the push
"server" (sending the posts to google) needs to register and get its
AUTH token (I have this). How often does one need to re-aquire a
token? until the POST results in an unauthorized error? is there an
approximate time on how long these auth tokens are valid for?

2) Similar to the above, except on the client (phone). I get a
registration_id and send it to my push server, how long is this valid
for? Should the client be updating its registration_id say once per
day?

3) I understand if I am unable to push a message to google, that I
must use exponential retry. Can I assume that once google has my
message it will keep trying to send it to the device (if it is powered
off) so that it will receive it once it is active again?

Thanks for the help!

PS. I can post my source code for my webserver (ASP.net/C#) if anyone
is interested or needs a jump start.

cmolson

unread,
Sep 20, 2010, 10:07:08 PM9/20/10
to android-c2dm
Okay after reading the docs again, I answered number 2 (well google
answered it).

"The registration ID lasts until the application explicitly
unregisters itself, or until Google refreshes the registration ID for
your application."

So I just need to make sure every time google sends me a register
intent I update my registration_id, and if it is different than it was
before, I need to send it to the server.

Also I guess number 1 is pretty easy, if I get an error sending the
push to google (401 error) than I need to re-register and get a new
client auth token.

Costin Manolache

unread,
Sep 20, 2010, 11:48:29 PM9/20/10
to androi...@googlegroups.com
On Mon, Sep 20, 2010 at 7:07 PM, cmolson <cmol...@gmail.com> wrote:
Okay after reading the docs again, I answered number 2 (well google
answered it).

"The registration ID lasts until the application explicitly
unregisters itself, or until Google refreshes the registration ID for
your application."

So I just need to make sure every time google sends me a register
intent I update my registration_id, and if it is different than it was
before, I need to send it to the server.


Correct. This is not a frequent event, but you should be able to handle it.
 
Also I guess number 1 is pretty easy, if I get an error sending the
push to google (401 error) than I need to re-register and get a new
client auth token.

You should't store user/pass on your server or try to get a new auth token - you may 
get a captcha, and it's not very secure to store your password. 

The server will give you a refresh auth token - examples:





Costin
Reply all
Reply to author
Forward
0 new messages