I have a mobile app, that registers to a c2dm server.
I have a server that sends a message to my app, to push a notification. The server receives ok result code from google c2dm.
In LogCat i see that my app receives the message but immediately produces the error i have in my post. And also the notification that i created is ignored.
08-10 16:28:09.157: W/GTalkService(13962): [DataMsgMgr] broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=com.example.c2dmclient (has extras) }
i don't get it. My manifest file is:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.c2dmclient"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<permission android:name="com.example.c2dmclient.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.example.c2dmclient.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.GET_ACCOUNTS" />
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".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=".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.example.c2dmclient" />
</intent-filter>
</receiver>
<receiver
android:name=".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.example.c2dmclient" />
</intent-filter>
</receiver>
<activity android:name="com.example.c2dmclient.RegistrationResultActivity" >
</activity>
<activity android:name="com.example.c2dmclient.MessageReceivedActivity" >
</activity>
</application>
</manifest>
If someone could help me please. i'm out of ideas
According to this forum post the situation arises in Android 3.1+ when the receiving app is in stopped state on the device (for example by using force stop from the settings). It will only start to receive messages again when it is manually started.
See also this post
Finally i have found where was the problem. When i was creating the notification, in the place of logo id, i have put 0. Now all it's working.