My app has registered with Google C2DM and got the registration ID, and device Id.
Am sending the same to my app server.
My app server tries to push notification to the registration id.
App server gets 200 response code.
But I never get the notification from google.
During registration I gave my package name as "com.info.customer"
This is the same as in my manifest.
I have registered C2DMMessageReceiver in my manifest as well.
Here is my xml.
Using xml Syntax Highlighting
- <?xml version="1.0" encoding="utf-8"?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.info.customer"
- android:versionCode="1"
- android:versionName="1.0" >
- <uses-sdk android:minSdkVersion="8" />
- <permission
- android:name="com.info.customer.permission.C2D_MESSAGE"
- android:protectionLevel="signature" />
- <!-- Permissions -->
- <uses-permission android:name="com.info.customer.permission.C2D_MESSAGE" />
- <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" />
- <uses-permission android:name="android.permission.ACCOUNT_MANAGER" />
- <uses-permission android:name="android.permission.GET_ACCOUNTS" />
- <application
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name" >
- <!-- Main activity. This activity is Launched when the app is loaded. -->
- <activity
- android:label="@string/app_name"
- android:name="com.info.customer.ui.SplashScreenActivity" >
- <intent-filter >
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <!--
- Only C2DM servers can send messages for the app. If permission is
- not set - any other app can generate it
- -->
- <receiver
- android:name=".c2dm.C2DMRegistrationReceiver"
- android:permission="com.google.android.c2dm.permission.SEND" >
- <intent-filter >
- <action android:name="com.google.android.c2dm.intent.REGISTRATION" >
- </action>
- <category android:name="com.info.customer" />
- </intent-filter>
- </receiver>
- <receiver
- android:name=".c2dm.C2DMMessageReceiver"
- android:permission="com.google.android.c2dm.permission.SEND" >
- <intent-filter >
- <action android:name="com.google.android.c2dm.intent.RECEIVE" >
- </action>
- <category android:name="com.info.customer" />
- </intent-filter>
- </receiver>
- <activity
- android:configChanges="keyboardHidden|orientation"
- android:label="@string/app_name"
- android:name="com.info.customer.ui.VLocityCustomerActivity"
- android:screenOrientation="portrait"
- android:windowSoftInputMode="adjustPan" >
- </activity>
- <activity
- android:configChanges="keyboardHidden|orientation"
- android:label="@string/app_name"
- android:name="com.info.customer.ui.MessageReceivedActivity"
- android:screenOrientation="portrait"
- android:windowSoftInputMode="adjustPan" >
- </activity>
- </application>
- </manifest>
Parsed in 0.009 seconds, using GeSHi 1.0.8.4
and my C2DMMessageReceiver class
Using java Syntax Highlighting
- public class C2DMMessageReceiver extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent intent) {
- String action = intent.getAction();
- Log.w("C2DM", "Message Receiver called");
- if ("com.google.android.c2dm.intent.RECEIVE".equals(action)) {
- Log.w("C2DM", "Received message");
- final String payload = intent.getStringExtra("payload");
- Log.d("C2DM", "dmControl: payload = " + payload);
- // TODO Send this to my application server to get the real data
- // Lets make something visible to show that we received the message
- createNotification(context, payload);
- }
- }
- public void createNotification(Context context, String payload) {
- Log.i("MESSAGE RECEIVED ACTIVITY", "PAYLOAD = "+payload);
- NotificationManager notificationManager = (NotificationManager) context
- .getSystemService(Context.NOTIFICATION_SERVICE);
- Notification notification = new Notification(R.drawable.ic_launcher,
- "Message received", System.currentTimeMillis());
- // Hide the notification after its selected
- notification.flags |= Notification.FLAG_AUTO_CANCEL;
- Intent intent = new Intent(context, MessageReceivedActivity.class);
- intent.putExtra("payload", payload);
- PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
- intent, 0);
- notification.setLatestEventInfo(context, "Message",
- "New message received", pendingIntent);
- notificationManager.notify(0, notification);
- }
- }
Parsed in 0.035 seconds, using GeSHi 1.0.8.4
notification never reaches my device. Log doesn't output any thing from C2DMMessageReciever class.
Is there any thing that I have done wrong here?
Any suggestions are extremely appreciated.
Thanks.


