android - 未调用来自 GCMIntentService 的 onRegistered()

标签 android push-notification google-cloud-messaging

未调用 GCMIntentService 的 onRegisterd() 方法。

在日志中显示如下: onReceive:com.google.android.c2dm.intent.REGISTRATION GCM IntentService 类:com.example.dailysales.GCMIntentService 获取唤醒锁 我的 AndroidManifest.XML 文件代码如下:

<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.example.dailysales" />
        </intent-filter>
    </receiver>

    <service android:name="com.example.dailysales.backgroundservice.InboxMessageLoadingService" >
    </service>
    <service
        android:name=".GCMIntentService"
        android:enabled="true" >
    </service>

最佳答案

这个答案可能对您有帮助:https://stackoverflow.com/a/18598887/4195406

您正在使用来自 Google GCM 客户端库的 com.google.android.gcm.GCMBroadcastReceiver 广播接收器。此类希望 Intent 服务位于您应用的主包中。

您应该将 GCMIntentService 移动到应用的主包中,或者覆盖 GCMBroadcastReceiver

关于android - 未调用来自 GCMIntentService 的 onRegistered(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28584411/

相关文章:

android - 无法从 androidx.fragment.app.Fragment.getViewModelStore 处的分离 fragment 访问 spy ( fragment )对象的 ViewModel

php - 当我的应用程序关闭时,GCM 消息不会出现在我的应用程序中

android - HC-05 + Android(回声/数据错误)

Firebase 云消息传递 : REST API responds with "INVALID_KEY"

ios - Phonegap 推送通知不会出现在状态栏中,也不会出现在使用 PushPlugin 插件的 iOS 锁定屏幕中

android - 取消在 Activity 中不起作用以取消特定的推送通知 android

android - 如何在android中获取推送通知消息?

android - 无法在安装在 4.1 的旧版本上的我的应用程序上接收 android GCM 消息

android - 尝试打开 Android XML 文件时,如何修复 Eclipse 中出现的 nullpointerexception?

android - setImageBitmap() 不工作