GCMBroadcastReceiver 未使用 list 或动态注册
<receiver
android:name="com.ee.nowmedia.core.pushnotification.PushBroadcastReceiver"
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.ee.nowmedia.core.pushnotification" />
</intent-filter>
</receiver>
最佳答案
自 2018 年 4 月 10 日起,Google 已弃用 GCM。 GCM 服务器和客户端 API 已弃用,最快将于 2019 年 4 月 11 日删除。将 GCM 应用程序迁移到 Firebase Cloud Messaging (FCM) ,它继承了可靠且可扩展的 GCM 基础架构,以及许多新功能。查看migration guide了解更多。在 Google Cloud Messaging -- DEPRECATED 4/10/2018 阅读更多内容文档
所以代码
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
......
</intent-filter>
</receiver>
自 8.0 起以及 2019 年 4 月 11 日之后对每个 API 都无用。
关于android - oreo(8.0) 或更高版本中的 GCMBroadcastReceiver 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51782425/