I am trying to do C2DM service in my Android app. I referring this link for help.
But not able to get registrationID from C2DM server. I think it may be the issue of appID that I am sending to C2DM server.
Actually I am giving like this for appId:
intent.putExtra("app",PendingIntent.getBroadcast(this, 0, new Intent(), 0));
Is it ok or anything else should be added. Please help me in this. Any help will be appreciated.
I work with the following link provided by google.And it works fine.
Make sure you have Market Sync on your Android device.
C2DM Google documentation
It would be easy to sort out your problem, if you paste your manifest code in your question. For more precaution please check your manifest by following two steps.
1) = Have you added following permissions in your manifest ?
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<permission android:name="com.yourpackage.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.yourpackage.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
2) = Have you added following lines within your application tag ?
<service android:name=".C2DMReceiver" />
<receiver android:name="com.google.android.c2dm.C2DMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.yourpackage" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.yourpackage" />
</intent-filter>
</receiver>
Note:- Please replace "com.yourpackage" according to your project.
Related
I'm trying to set up push notifications in an app for the first time. I think the server side is OK (the message send to google comes back with status code 200, and I see a success result in the response body).
But the device never does anything :(
Manifest is set as follows:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="my.package" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="my.package.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="my.package.permission.C2D_MESSAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/appName"
android:theme="#style/AppTheme" >
<activity
android:name="my.package.activity.MainActivity"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:enabled="true"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="my.package" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
</intent-filter>
</receiver>
<service
android:name=my.package.NotificationListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
</application>
</manifest>
And the NotificationListenerService is like this:
public class NotificationListenerService extends GcmListenerService {
#Override
public void onMessageReceived(String from, Bundle data) {
String message = data.getString("message");
Log.d("MyApp", "message);
Notification.ShowNotification("test", getApplicationContext());
}
}
I think that's all I need according to https://developers.google.com/cloud-messaging/android/client (asides from the stuff to handle reset tokens which I've not added yet. My token registration seems to work as I can see the token in the dev console data store.)
I've tried looking at logcat but nothing obvious seems to appear. Do I need to "start" the service in some way? The documentation suggests not... I'm obviously missing something fundamental though!
When you send a message, your server normally gets a message_id as a response. Using the diagnostics tool with the message_id could be useful to make sure that GCM correctly relayed the message.
Is Google Play Services up-to-date on your device ?
SEE EDIT#2 at the end of the question (Google updated the way push is implemented so it became easier to handle gcm and parse together)
I already use GCM inside a application and I would like to add parse as an alternative. This is what I have now (all the permissions are correctly declared):
<service
android:name="com.mypackagename.GCMIntentService"
android:enabled="true" />
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.mypackagename.GCMIntentService" />
</intent-filter>
</receiver>
The 'GCMIntentService' (inherits from 'GCMBaseIntentService') class handles the server registration and receiving of messages - it works fine and all the push messages are received. The server sometimes sends custom data so I handle the messages myself and create the notifications programmatically (the intent used when the notification is clicked has some important extras sent from the server).
I would like to somehow make parse behave in the same way in order to be able to send channel pushes from the parse website and create my own notifications, but everything I tried failed (following the android push tutorial isn't really working for my problem). Is there anyone who tried a similar thing? I'm kind of out of ideas after spending a lot of time tweaking the push guides/tutorials - sometimes I don't receive any notifications; sometimes both parse and my receiver are called and I get double notifications. I also tried to register using parse REST apis and handle everything myself but found out it isn't possible on Android.
So, how could I handle both parse pushes and the traditional gcm pushes (using my server) in such a way that I have access to both notifications and I can build them from scratch (create my own pending notifications with the required extras)?
EDIT#1:
The first thing I tried was to use the parse service and have a single broadcast receiver to handle the GCM messages:
AndroidMaifest.xml:
<service
android:name="com.mypackagename.GCMIntentService"
android:enabled="true" />
<service android:name="com.parse.PushService"
android:enabled="true"/>
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.mypackagename.GCMIntentService" />
</intent-filter>
</receiver>
And the parse library requires the following initializations:
Parse.initialize(context, appId, apiKey);
PushService.setDefaultPushCallback(context, MainActivity.class);
// I'm subscribing to channel push because I send channel pushes from the
// parse console
PushService.subscribe(context, MDConstants.PARSE_PUSH_CHANNEL, MainActivity.class);
ParseInstallation.getCurrentInstallation().saveInBackground();
The problem is that I receive the notifications from my other provider but I don't receive anything from parse (all the permissions are declared) and I get the following error from the parse library (when receiving the error the parse registration is not properly done - I can't see my device in the parse console):
E/com.parse.ManifestInfo(11677): Cannot use GCM for push because the app manifest is missing some required declarations. Please make sure that these permissions are declared as children of the root <manifest> element:
E/com.parse.ManifestInfo(11677):
E/com.parse.ManifestInfo(11677): <uses-permission android:name="android.permission.INTERNET" />
E/com.parse.ManifestInfo(11677): <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
E/com.parse.ManifestInfo(11677): <uses-permission android:name="android.permission.VIBRATE" />
E/com.parse.ManifestInfo(11677): <uses-permission android:name="android.permission.WAKE_LOCK" />
E/com.parse.ManifestInfo(11677): <uses-permission android:name="android.permission.GET_ACCOUNTS" />
E/com.parse.ManifestInfo(11677): <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
E/com.parse.ManifestInfo(11677): <permission android:name="com.mypackagename.permission.C2D_MESSAGE" android:protectionLevel="signature" />
E/com.parse.ManifestInfo(11677): <uses-permission android:name="com.mypackagename.permission.C2D_MESSAGE" />
E/com.parse.ManifestInfo(11677):
E/com.parse.ManifestInfo(11677): Also, please make sure that these services and broadcast receivers are declared as children of the <application> element:
E/com.parse.ManifestInfo(11677):
E/com.parse.ManifestInfo(11677): <service android:name="com.parse.PushService" />
E/com.parse.ManifestInfo(11677): <receiver android:name="com.parse.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
E/com.parse.ManifestInfo(11677): <intent-filter>
E/com.parse.ManifestInfo(11677): <action android:name="com.google.android.c2dm.intent.RECEIVE" />
E/com.parse.ManifestInfo(11677): <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
E/com.parse.ManifestInfo(11677): <category android:name="com.mypackagename" />
E/com.parse.ManifestInfo(11677): </intent-filter>
E/com.parse.ManifestInfo(11677): </receiver>
E/com.parse.PushService(11677): Tried to use push, but this app is not configured for push due to: Push is not configured for this app because the app manifest is missing required declarations. Please add the following declarations to your app manifest to support either GCM or PPNS for push (or both). To enable GCM support, please make sure that these permissions are declared as children of the root <manifest> element:
E/com.parse.PushService(11677):
E/com.parse.PushService(11677): <uses-permission android:name="android.permission.INTERNET" />
E/com.parse.PushService(11677): <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
E/com.parse.PushService(11677): <uses-permission android:name="android.permission.VIBRATE" />
E/com.parse.PushService(11677): <uses-permission android:name="android.permission.WAKE_LOCK" />
E/com.parse.PushService(11677): <uses-permission android:name="android.permission.GET_ACCOUNTS" />
E/com.parse.PushService(11677): <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
E/com.parse.PushService(11677): <permission android:name="com.mypackagename.permission.C2D_MESSAGE" android:protectionLevel="signature" />
E/com.parse.PushService(11677): <uses-permission android:name="com.mypackagename.permission.C2D_MESSAGE" />
E/com.parse.PushService(11677):
E/com.parse.PushService(11677): Also, please make sure that these services and broadcast receivers are declared as children of the <application> element:
E/com.parse.PushService(11677):
E/com.parse.PushService(11677): <service android:name="com.parse.PushService" />
E/com.parse.PushService(11677): <receiver android:name="com.parse.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
E/com.parse.PushService(11677): <intent-filter>
E/com.parse.PushService(11677): <action android:name="com.google.android.c2dm.intent.RECEIVE" />
E/com.parse.PushService(11677): <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
E/com.parse.PushService(11677): <category android:name="com.mypackagename" />
E/com.parse.PushService(11677): </intent-filter>
E/com.parse.PushService(11677): </receiver>
E/com.parse.PushService(11677): To enable PPNS support, please make sure that these permissions are declared as children of the root <manifest> element:
E/com.parse.PushService(11677):
E/com.parse.PushService(11677): <uses-permission android:name="android.permission.INTERNET" />
E/com.parse.PushService(11677): <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
E/com.parse.PushService(11677): <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
E/com.parse.PushService(11677): <uses-permission android:name="android.permission.VIBRATE" />
E/com.parse.PushService(11677): <uses-permission android:name="android.permission.WAKE_LOCK" />
E/com.parse.PushService(11677):
E/com.parse.PushService(11677): Also, please make sure that these services and broadcast receivers are declared as children of the <application> element:
E/com.parse.PushService(11677):
E/com.parse.PushService(11677): <service android:name="com.parse.PushService" />
E/com.parse.PushService(11677): <receiver android:name="com.parse.ParseBroadcastReceiver">
E/com.parse.PushService(11677): <intent-filter>
E/com.parse.PushService(11677): <action android:name="android.intent.action.BOOT_COMPLETED" />
E/com.parse.PushService(11677): <action android:name="android.intent.action.USER_PRESENT" />
E/com.parse.PushService(11677): </intent-filter>
E/com.parse.PushService(11677): </receiver>
EDIT#2:
I updated the way gcm push was handled based on the google push notification developer guide. While implementing the class that extends 'GcmListenerService', you can now easily check if the 'from' arguments is the same as your google project id used to register for push.
public class MyGcmListenerService extends GcmListenerService {
#Override
public void onMessageReceived(String from, Bundle data) {
// only handle gcm messages that come from the same project id used to register
if (from.equals("Your google project id)) {
// handle the gcm push
}
}
}
Also, parse updated their libraries (I'm using '1.9.4' right now) and you can subclass the 'ParsePushBroadcastReceiver' to handle the notifications as you'd like. See the guide here for a basic implementation.
Parse initialization in the 'onCreate' method of your 'Application' class:
Parse.initialize(this, "your parse app id", "your parse client key");
// subscribing to a channel
ParsePush.subscribeInBackground("your channel name", new SaveCallback() {
#Override
public void done(ParseException e) {
if (e == null) {
Log.d("com.parse.push", "successfully subscribed to the broadcast channel.");
} else {
Log.e("com.parse.push", "failed to subscribe for push");
}
}
});
The broadcast receiver implementation:
public class MyParsePushBroadcastReceiver extends ParsePushBroadcastReceiver {
#Override
protected void onPushReceive(Context context, Intent intent) {
// handle the parse push notification
}
}
The manifest declaration for both parse and gcm:
...
<!-- GCM listener service -->
<service
android:name=".MyGcmListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
...
<!-- Parse broadcast receiver -->
<receiver android:name=".MyParsePushBroadcastReceiver" android:exported="false">
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
...
I only added the service and the receiver, but you need to make sure you follow the GCM guide and the Parse push guides to have a full implementation (for example, google also added a way to handle the token refresh - a sample containing full code samples can be found here).
If I understand correctly, you want your code to handle all the incoming GCM messages, regardless of their source (which can be either your server or Parse website), which means you don't want the Parse code in your app do handle them.
You can achieve this by declaring only a single broadcast receiver handling com.google.android.c2dm.intent.RECEIVE action in your manifest. That would be your GCMBroadcastReceiver class, which would handle all the arriving GCM messages.
The behavior you are currently experiencing can happen when you declare two broadcast receivers that handle the same action.
This question already has an answer here:
Register GCM from a library project
(1 answer)
Closed 8 years ago.
i am followin this tutorial frrom androidHive to intigrate GCM in my app.
in my previous project i have integrated GCM by following this blog. And that is working fine.
But, in my new project, this is not working. i am getting no data in my server. the only difference between this two project is: in my previous project , all my GCM related classes were in my project's default package. but in my new project the GCM related classes are in 'com.gcm' package, and i am calling them from another package's activity (which is my app's default package). i have track that (using Log.e) the code is executed to
//in -- MainActivity.java
// Check if regid already presents
if (regId.equals("")) {
// Registration is not present, register now with GCM
GCMRegistrar.register(this, SENDER_ID);
// after this nothing is happening
} else {
i have 'Log.e' in every classes and every possible places :( but they are not printing anything.
i think the service and receiver is not setted properly.
so, i think i have to change in the manifest. but i don't no what to change. can anybody help me ?
the manifest from the blog:
In the following code replace all 'com.androidhive.pushnotifications'
with your android package name.
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidhive.pushnotifications"
android:versionCode="1"
android:versionName="1.0" >
<!-- GCM requires Android SDK version 2.2 (API level 8) or above. -->
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<!-- GCM connects to Internet Services. -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- Creates a custom permission so only this app can receive its messages. -->
<permission
android:name="com.androidhive.pushnotifications.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
// i have changed 'com.androidhive.pushnotifications' to 'com.gcm' but getting error.
// so i have rplace 'com.androidhive.pushnotifications' with my default package name.
<uses-permission android:name="com.androidhive.pushnotifications.permission.C2D_MESSAGE" />
// i have changed 'com.androidhive.pushnotifications' to 'com.gcm' but not woeking
<!-- This app has permission to register and receive data message. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- Network State Permissions to detect Internet status -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Permission to vibrate -->
<uses-permission android:name="android.permission.VIBRATE" />
<!-- Main activity. -->
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<!-- Register Activity -->
<activity
android:name=".RegisterActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Main Activity -->
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden"
android:label="#string/app_name" >
</activity>
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<!-- Receives the actual messages. -->
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<!-- Receives the registration id. -->
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.androidhive.pushnotifications" />
// what will be this?
// replace with default package or
'com.gcm' package ?
</intent-filter>
</receiver>
<service android:name=".GCMIntentService" />
// i have change this to 'com.gcm.GCMIntentService'
</application>
</manifest>
..
<permission
android:name="com.androidhive.pushnotifications.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
// i have changed 'com.androidhive.pushnotifications' to 'com.gcm' but getting error.
// so i have rplace 'com.androidhive.pushnotifications' with my default package name.
<uses-permission
android:name="com.androidhive.pushnotifications.permission.C2D_MESSAGE" />
// i have changed 'com.androidhive.pushnotifications' to 'com.gcm' but not woeking
..
<service android:name=".GCMIntentService" />
// i have change this to 'com.gcm.GCMIntentService'
..
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<!-- Receives the actual messages. -->
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<!-- Receives the registration id. -->
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.androidhive.pushnotifications" />
// what will be this?
// replace with default package or
'com.gcm' package ?
</intent-filter>
</receiver>
EDIT: (SOLUTION)
as eran suggested the answer of this question, the solution is in the answer of the question.
I suggest follow the instructions from Google GCM's website instead : Google GCM Client Dev Guide
You should extend a broadcast receiver either from Google's GCMBroadcastReceiver, or WakefulBroadcastReceiver. In this extended receiver, define where your GcmIntentService class is. If Your GcmIntentService is not in your main package path, then you need to enter the package path.
Google example for in-app payment suggests to add the manifest entry in order to receive the payment confirmations. But in Native Extension for AIR, the receiver will not be found as its a different package. So i moved the receiver part to code as follows
final IntentFilter filter = new IntentFilter("com.android.vending.billing.IN_APP_NOTIFY");
filter.addAction("com.android.vending.billing.RESPONSE_CODE");
filter.addAction("com.android.vending.billing.PURCHASE_STATE_CHANGED");
a.registerReceiver(billingReceiver, filter);
But the service's onreceive() method never gets called.
Is there a different way of registering the activity to get receiver calls?
According to some reference sites, adding the billing receiver in code doesn't work. So moved it to manifest file, removed the package and referred it from the root directory. So problem solved.
Manifest for AIR app would look like this for more info for those who are trying out!
<android>
<manifestAdditions>
<![CDATA[
<manifest android:installLocation="auto">
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<application>
<service android:name="<package>.BillingService" />
<receiver android:name="<package>.BillingReceiver">
<intent-filter>
<action android:name="com.android.vending.billing.IN_APP_NOTIFY" />
<action android:name="com.android.vending.billing.RESPONSE_CODE" />
<action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED" />
</intent-filter>
</receiver>
</application>
</manifest>]]>
</manifestAdditions>
</android>
I have used This guide. But if i add it to another project, i dont receive anything:
I have made changes to the manifest so it matches the guide(I think):
Question: But now i dont get any response to my registration attempt.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.vogella.android.c2dm" android:versionCode="1"
android:versionName="1.0">
<permission android:name="de.vogella.android.c2dm.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="de.vogella.android.c2dm.permission.C2D_MESSAGE" />
<!-- Permissions -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application android:icon="#drawable/ic_launcher" android:label="#string/app_name">
<activity android:name="RegisterActivity" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="de.vogella.android.c2dm.C2DMReceiver" />
<!-- Only C2DM servers can send messages for the app. If permission is
not set - any other app can generate it -->
<receiver android:name="com.google.android.c2dm.C2DMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<!-- Receive the actual message -->
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="de.vogella.android.c2dm" />
</intent-filter>
<!-- Receive the registration id -->
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="de.vogella.android.c2dm" />
</intent-filter>
</receiver>
<activity android:name="ResultActivity"></activity>
</application>
</manifest>
How to start registering (Have checked that it reaches into the if condition)(is called from C2DM2Activity):
public void checkRegistered() {
String registered = C2DMessaging
.getRegistrationId(getApplicationContext());
if (registered.equals("")) {
Log.i(TAG, "starting registration of C2DM");
C2DMessaging.register(this, C2DMID);
}
}
Filestructure:
What if you add a '.' to your service name, I think that's the way it should be.
Try this <service android:name=".c2dm.C2DMReceiver" />
In the code part. C2DMBaseReceiver, there is a place where it defines the C2DMReceiver to be in the application package default folder.
Thanks to all others for trying to help.
Try to change
android:name="com.google.android.c2dm.C2DMBroadcastReceiver"
To
android:name="dk.lector.cms.c2dm.YourReceiverClassName"
You said in a comment above that C2DMBroadcastReceiver is your receiver. Then what is with the C2DMReceiver that I see in your de.vogella.android.c2dm package?
And you question is about how to start registering. In the tutorial under section 2.2. Getting the registration ID for the mobile app there is a register method that needs to be called. When the registrationId comes back from the Google server it is caught in your receiver's onReceive. In his tutorial, the receiver for registering is C2DMRegistrationReceiver. If you say that C2DMBroadcastReceiver is your receiver and you are sure about that, just call register and the onReceive should receive the message.
Also, you should try posting the entire Manifest.xml. Make sure you are using the permission for INTERNET and a custom permission like:
<permission
android:name="de.vogella.android.c2dm.simpleclient.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission
android:name="de.vogella.android.c2dm.simpleclient.permission.C2D_MESSAGE" />
The package name u got registered with C2DM is it same as other project you transfered because for C2DM it identify an app with its Package name