<small id='E927V'></small><noframes id='E927V'>

<legend id='E927V'><style id='E927V'><dir id='E927V'><q id='E927V'></q></dir></style></legend>
<i id='E927V'><tr id='E927V'><dt id='E927V'><q id='E927V'><span id='E927V'><b id='E927V'><form id='E927V'><ins id='E927V'></ins><ul id='E927V'></ul><sub id='E927V'></sub></form><legend id='E927V'></legend><bdo id='E927V'><pre id='E927V'><center id='E927V'></center></pre></bdo></b><th id='E927V'></th></span></q></dt></tr></i><div id='E927V'><tfoot id='E927V'></tfoot><dl id='E927V'><fieldset id='E927V'></fieldset></dl></div>

    • <bdo id='E927V'></bdo><ul id='E927V'></ul>
    <tfoot id='E927V'></tfoot>

    1. 在 Nougat 上多次接收 FCM 通知

      时间:2023-07-31
        <tfoot id='Qs0Wu'></tfoot>

            • <bdo id='Qs0Wu'></bdo><ul id='Qs0Wu'></ul>

              <small id='Qs0Wu'></small><noframes id='Qs0Wu'>

                <i id='Qs0Wu'><tr id='Qs0Wu'><dt id='Qs0Wu'><q id='Qs0Wu'><span id='Qs0Wu'><b id='Qs0Wu'><form id='Qs0Wu'><ins id='Qs0Wu'></ins><ul id='Qs0Wu'></ul><sub id='Qs0Wu'></sub></form><legend id='Qs0Wu'></legend><bdo id='Qs0Wu'><pre id='Qs0Wu'><center id='Qs0Wu'></center></pre></bdo></b><th id='Qs0Wu'></th></span></q></dt></tr></i><div id='Qs0Wu'><tfoot id='Qs0Wu'></tfoot><dl id='Qs0Wu'><fieldset id='Qs0Wu'></fieldset></dl></div>

                  <tbody id='Qs0Wu'></tbody>
              1. <legend id='Qs0Wu'><style id='Qs0Wu'><dir id='Qs0Wu'><q id='Qs0Wu'></q></dir></style></legend>
                本文介绍了在 Nougat 上多次接收 FCM 通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我在我的应用中使用 Firebase 推送通知.但是,当我发送某个事件的通知时,我会在 Nougat 设备 上 2-3 分钟后多次收到通知.在版本低于 Nougat 的设备上,我只收到一条通知.

                I am using Firebase push notifications in my app. But when I am sending a notification for some event, I am getting notification's multiple times after 2-3 minutes on Nougat devices only. I am getting only a single notification on the devices which are having lower version than Nougat.

                我检查过服务器一次只发送一个通知.我的应用程序 gradle 有以下依赖项.

                I have checked that server is sending only a single notification at a time. I am having below dependency in my app gradle.

                compile `com.google.firebase:firebase-messaging:11.8.0`
                

                这是 FCM 监听器的代码:

                And here is the code for FCM Listener:

                public class MyFcmListenerService extends FirebaseMessagingService {
                
                    @Override
                public void onMessageReceived(RemoteMessage remoteMessage) {
                
                  }
                }
                

                在清单文件中:

                <service android:name="com.myApp.test.fcm.MyFcmListenerService">
                  <intent-filter>
                     <action android:name="com.google.firebase.MESSAGING_EVENT" />
                   </intent-filter>
                </service>
                

                推荐答案

                当我尝试从旧 GCM 迁移到新 FCM 时,这开始发生在我身上.您需要确保删除所有与 GCM 相关的代码,包括 gradle(删除 com.google.android.gms:play-services-gcm )和 Manifest

                This started happening to me when I tried to migrate from old GCM to new FCM. You need to make sure you remove all GCM related code, including gradle (remove com.google.android.gms:play-services-gcm ) and Manifest

                (删除:

                <uses-permission android:name="mypackage.permission.C2D_MESSAGE" />
                <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
                
                <permission
                    android:name="mypackage.permission.C2D_MESSAGE"
                    android:protectionLevel="signature" />
                

                )

                还要确保您CLEAN您的项目并REBUILD它,以删除对 GCM 类的任何缓存引用.最后一部分花了我大约 2 个小时才弄清楚.一个不错的技巧是查找所有 (F) "GCM" 并查看是否从生成的文件中获得命中.

                Also make sure you CLEAN your project and REBUILD it, to remove any cached reference to GCM classes. The last part took me like 2 hours to figure out. A nice trick can be to find-all (F) "GCM" and see if you get hits from the generated files.

                这篇关于在 Nougat 上多次接收 FCM 通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:推送通知已交付,但 didReceiveRemoteNotification 从未被称为 Swift 下一篇:Firebase 与 GCM 的向后兼容性

                相关文章

                <tfoot id='eoDEm'></tfoot>

                <legend id='eoDEm'><style id='eoDEm'><dir id='eoDEm'><q id='eoDEm'></q></dir></style></legend>

                <small id='eoDEm'></small><noframes id='eoDEm'>

                  <i id='eoDEm'><tr id='eoDEm'><dt id='eoDEm'><q id='eoDEm'><span id='eoDEm'><b id='eoDEm'><form id='eoDEm'><ins id='eoDEm'></ins><ul id='eoDEm'></ul><sub id='eoDEm'></sub></form><legend id='eoDEm'></legend><bdo id='eoDEm'><pre id='eoDEm'><center id='eoDEm'></center></pre></bdo></b><th id='eoDEm'></th></span></q></dt></tr></i><div id='eoDEm'><tfoot id='eoDEm'></tfoot><dl id='eoDEm'><fieldset id='eoDEm'></fieldset></dl></div>
                  • <bdo id='eoDEm'></bdo><ul id='eoDEm'></ul>