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

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

      1. <small id='t8qJ0'></small><noframes id='t8qJ0'>

      2. 通过注销限制 GCM/FCM 通知

        时间:2023-07-30

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

            1. <legend id='xFxxh'><style id='xFxxh'><dir id='xFxxh'><q id='xFxxh'></q></dir></style></legend>
                <tbody id='xFxxh'></tbody>

              <tfoot id='xFxxh'></tfoot>

                  本文介绍了通过注销限制 GCM/FCM 通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  有没有办法限制 Firebase 推送通知注册?不找话题.假设我有一个登录功能.我希望登录用户订阅推送通知.然后可以将令牌发送到服务器并存储.

                  Is there a way to restrict Firebase push notification registration? Not looking for topics. Let's say I have a login function. I want signed in users to be subscribed for push notifications. Then token can be sent to server and stored.

                  用户注销的同时,用户也要注销.

                  At the same time when users log out, user should also be unregistered.

                  那么目前有可用的机制吗?我浏览了 Firebase API 文档,但找不到任何内容.

                  So is there a mechanism available currently? I went through the Firebase API documentation but I could not find anything on that.

                  只是想知道我是否遗漏了什么.

                  Just want to know whether I have missed anything.

                  推荐答案

                  deleteToken()deleteInstanceId() 的区别请参考这里 回答.

                  For the difference on when to use deleteToken() vs deleteInstanceId(), refer to this answer.

                  即使是 GCM,也不建议在注销时取消注册应用实例(设备/用户).根据 GCM 文档

                  Unregistering an app instance (device/user) on logout is not advisable since even GCM. As per the GCM docs

                  出于以下原因,开发人员不应取消注册客户端应用程序作为注销或切换用户的机制:

                  Developers should never unregister the client app as a mechanism for logout or for switching between users, for the following reasons:

                  • 注册令牌不与特定的登录用户相关联.如果客户端应用取消注册然后重新注册,应用可以接收相同的注册令牌或不同的注册令牌.

                  • A registration token isn't associated with a particular logged in user. If the client app unregisters and then re-registers, the app can receive the same registration token or a different registration token.

                  注销和重新注册都可能需要长达五分钟的时间来传播.在此期间,消息可能会由于未注册状态而被拒绝,并且消息可能会发送给错误的用户.

                  Unregistration and re-registration may each take up to five minutes to propagate. During this time messages may be rejected due to the unregistered state, and messages may go to the wrong user.

                  如果您仍想继续,您仍然可以参考上述相同的文档.

                  If you still want to proceed, you can still refer to the same docs above.

                  注销和退订

                  客户端应用可以使用三种方法来停止从应用服务器接收消息和/或主题订阅:

                  There are three methods a client app can use to stop receiving messages and/or topic subscriptions from the app server:

                  • InstanceID deleteToken(),受众设置为应用服务器的发件人 ID,范围设置为 GCM.这会阻止来自特定应用服务器的消息(包括主题消息)

                  • InstanceID deleteToken() with audience set to the app server's sender ID and scope set to GCM. This stops messages (including topic messages) from a specific app server

                  InstanceID deleteID().这会停止来自所有应用服务器的所有先前注册和主题订阅的消息

                  InstanceID deleteID(). This stops messages from all previous registrations and topic subscriptions for all app servers

                  GCMPubSub 取消订阅().这会停止来自应用服务器特定主题的主题消息

                  GCMPubSub unsubscribe(). This stops topic messages from the specific topic of the app server

                  对于 FCM,它应该是 FirebaseInstanceId.

                  For FCM, it should be the FirebaseInstanceId.

                  这篇关于通过注销限制 GCM/FCM 通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:无法解决:play-services-tasks 下一篇:无法使用服务器 API 发送推送通知

                  相关文章

                  <legend id='teHlj'><style id='teHlj'><dir id='teHlj'><q id='teHlj'></q></dir></style></legend>
                  • <bdo id='teHlj'></bdo><ul id='teHlj'></ul>

                  <tfoot id='teHlj'></tfoot>

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

                1. <small id='teHlj'></small><noframes id='teHlj'>