我有一个注册到 c2dm 服务器的移动应用程序。
我有一个向我的应用程序发送消息以推送通知的服务器。服务器从 google c2dm 接收到 ok 结果代码。
在 LogCat 中,我看到我的应用程序收到了消息,但立即产生了我在帖子中遇到的错误。而且我创建的通知也被忽略了。
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) }
我不明白。我的清单文件是:
<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>
如果有人可以帮助我,请。我没主意了