Dear All, 

I'm currently learning how to use C2DM. But I still got confused about 
concept of "sender" and "client login".

*# The sender*
Do I have to create an email account e.g. ichsan.my...@gmail.com? It seems 
that one email is for one app only (e.g. package = ichsan.myapp). Is it 
true?

*# Client login*
How to create client login? Google says that I should use OAuth 2. But I 
still failed to use it. This is my steps. Would you please check if they're 
correct?

I log out from my personal email and log in as ichsan.my...@gmail.com.

1. Create a client ID
Since my application server is going to push message into Google C2DM 
server, I create a client id for my application server. I go to 
https://code.google.com/apis/console to create a client. This client type 
is "Installed Application". I get a client ID = CLNT123

2. Open C2DM service.
Sadly I cannot find it. I skip this part. Is it Okay?

3. Testing
# Getting a token
curl -k -d 
"response_type=code&client_id=CLNT123&scope=https://www.googleapis.com/c2dm&redirect_uri=urn:ietf:wg:oauth:2.0:oob";
 
https://accounts.google.com/o/oauth2/auth

But I got redirect (so I run it in browser instead). Should my application 
server follow that redirect to get the token? How long I a valid token last?
I got token TOKEN123

# Push a message
As my app started and registered itself using ichsan.my...@gmail.com as 
sender, I got error: Can not find the API. I'm sure I've download all 
libraries available for Android 2.2 and 4.0. Did I miss something?

If this succeed, is the following snippet the correct way to test pushing a 
message?

curl -k -H "Authorization: Bearer TOKEN123" --trace curl_trace.txt -d 
"registration_id=GENERATED_MYAPP_REG_ID" -d "data.message=something to 
talk" -d collapse_key=0 https://android.apis.google.com/c2dm/send

Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to