Android的C2DM身份验证令牌,一次或每一次 [英] Android C2DM Auth token, one time or every time

查看:115
本文介绍了Android的C2DM身份验证令牌,一次或每一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我概括我的计划实施C2DM到应用程序,并有一个基本的(阅读:愚蠢的)。关于该验证令牌

I am outlining my plan to implement C2DM into an application and have a basic (read: stupid) question about the Auth tokens.

客户端服务器需要使用白名单帐户与谷歌C2DM服务注册:

The client server needs to register with the google c2dm service using the white listed account:

有关测试:

curl https://www.google.com/accounts/ClientLogin -d Email=theEmailYouWhitelisted -d Passwd=pass****word -d accountType=HOSTED_OR_GOOGLE -d source="your_app_name_and_ver_for_logging_purposes_only" -d service=ac2dm

我的问题是,这是否会发生一次,每C2DM开户申请 - 即:使用白名单帐户得到一个服务器生成的权威性code,储存,那么每次消息被发送检索和使用:

My question is, does this happen once per application per c2dm account - ie: get the one server generated auth code using your whitelisted account, store it, then every time a message gets sent retrieve it and use:

curl --header "Authorization: GoogleLogin auth=**authFromRegistrationAbove**" "https://android.apis.google.com/c2dm/send" -d registration_id=**phoneRegistrationId(reciever)** -d "data.message=StringToPass" -d collapse_key=something -k

还是你必须申请新的验证code为每封邮件推?

Or do you have to request a new Auth code for every message being pushed?

推荐答案

存储的身份验证令牌为今后推动。从谷歌 C2DM页面

Store the auth token for future pushes. From the Google C2DM page:

能够存储的ClientLogin验证   令牌和客户端注册的ID。该   的ClientLogin验证令牌被包括在   POST请求的发送头   消息。有关此更多的讨论   话题,请参见的ClientLogin的安装   应用。的服务器应存储   令牌并有一个政策刷新   它定期。

Able to store the ClientLogin Auth token and client registration IDs. The ClientLogin Auth token is included in the header of POST requests that send messages. For more discussion of this topic, see ClientLogin for Installed Applications. The server should store the token and have a policy to refresh it periodically.

另外请注意,谷歌会定期刷新令牌的更新 - 客户端验证头。请参阅<一href="http://groups.google.com/group/android-c2dm/browse_thread/thread/00b03b6a0985059f/14b69680f3b6926b">this讨论对 Android的C2DM 组的详细信息。

Also note that Google will periodically refresh the token in an Update-Client-Auth header. See this discussion on the android-c2dm group for details.

这是我的经验,我不知道什么时候或者为什么谷歌选择刷新令牌。它发生在我身上一样频繁每一天,有时每周它。

From my experience, I can't tell when or why Google chooses to refresh the token. It's happened to me as frequently as every day, and sometimes it's every week.

这篇关于Android的C2DM身份验证令牌,一次或每一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆