Reputation: 4309
I have searched through net about C2DM and the process of registration of android device to the C2DM is very confusing. In the code below :-
Intent rI = new Intent ("com.google.android.c2dm.intent.REGISTER");
rI.putExtra("app",PendingIntent.getBroadcast(this, 0, new Intent(), 0));
rI.putExtra("sender", "[email protected]");
this.startService(rI);
What is "app", "sender" and "[email protected]"? I tried to signup for the Android C2DM but I couldn't understand what is the Role account email. Any advice is appreciated.
Upvotes: 1
Views: 762
Reputation: 48871
In the code you have shown, the only thing you need to replace is [email protected]
.
First you need to create a Google GMail account, e.g., [email protected]
Then you need to go to the Sign Up for Android Cloud to Device Messaging page. Fill in all of the details on the sign up page and provide your GMail account as the 'Role (sender)'. Then in your code, replace [email protected]
with the GMail address you've created.
EDIT: In response to your comment/question.
rI
is an Intent
and you are putting 'extra' data into that Intent
which is passed to the Google C2DM registration service.
When you put data into an Intent
, it has to have a key name so the receiver of the Intent
is able to extract it using getStringExtra(keyName)
(for example). The keys 'app' and 'sender' are reserved for C2DM registration and MUST be used as they are in that code otherwise the C2DM registration process will fail.
Upvotes: 1