我确认应用程序可以接收关于galaxy nexus平板电脑(4.2)和三星galaxy s3手机(4.1.1)的通知,但无法在三星Galaxy标签10.1(4.0.4)和三星7英寸平板电脑(4.0。 4)
有多个Google帐户登录平板电脑。 我收到了注册ID,当我发送通知时出现错误
错误日志,
05-22 14:40:47.220: W/GTalkService(10357): [DataMsgMgr] broadcast
intent callback: result=CANCELLED forIntent {
act=com.google.android.c2dm.intent.RECEIVE cat=[ xxx ] (has extras) }
05-22 14:40:47.225: W/GTalkService(10357): Receiver package not found,
unregister application com.myapp.example sender
Android清单具有所有必要的权限
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- Only this application can receive the messages and registration result -->
<permission android:name="com.myapp.example.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.myapp.example.permission.C2D_MESSAGE" />
<receiver
android:name="com.myapp.example.gcm.GCMReceiver"
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.myapp.example.gcm" />
</intent-filter>
</receiver>
<service android:name=".gcm.GCMService" />
答案 0 :(得分:2)
我在接收器中修改了类别后开始工作了
from
<category android:name="com.myapp.example.gcm" />
to
<category android:name="com.myapp.example" />