This is how it's handle on the App server for chrome to phone.
URL url = new URL(serverConfig.getC2DMUrl());
HttpURLConnection conn =
(HttpURLConnection) url.openConnection();
...
// Check for updated token header
String updatedAuthToken =
conn.getHeaderField("Update-Client-Auth");
if (updatedAuthToken != null &&
!authToken.equals(updatedAuthToken)) {
serverConfig.updateToken(updatedAuthToken);
}
Please correct me if I'm wrong here.
Johan
--
Johan Nilsson
http://twitter.com/johanni/
http://www.linkedin.com/in/johanjohan
Thank you Costin.C2DM framework - it is in labs / beta right ? When it is expected to be officially released for production usage ?Can you please let me know. So that we can better plan our release.
conn.setRequestProperty("Authorization", "GoogleLogin auth=" + authToken);
I'm getting this error:
com.google.android.c2dm.server.C2DMessaging sendNoRetry: Unauthorized - need tokenHi Costin,You said:You need to do ClientLogin off-line ( either a script, or whatever you want ), and store the Authtoken on the server. The token can only be used for C2DM, it won't allow access to anything else.And the server will give you a fresh one when the old one is about to expire.The ClientLogin auth token that's generated is done using the "Role account email" that we provided in the C2DM sign-up, correct? I've been doing:curl https://www.google.com/accounts/ClientLogin -d Email=<email> -d "Passwd=<password>" -d accountType=HOSTED_OR_GOOGLE -d source<company-app-version> -d service=ac2dm
...which returns:SID=...LSID=...AUTH=......and I've been using the token after AUTH= as part of the send request:conn.setRequestProperty("Authorization", "GoogleLogin auth=" + authToken);
I'm getting this error:
com.google.android.c2dm.server.C2DMessaging sendNoRetry: Unauthorized - need token
I'm wondering:1) Do we have to use an @gmail.com address or is any google apps managed account sufficient?
2) Does the package name provided in the setup matter?
3) What am I missing? How can I debug this?
Thanks,George