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

    <small id='2qroY'></small><noframes id='2qroY'>

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

      1. <tfoot id='2qroY'></tfoot>
      2. FCM 令牌何时到期?

        When does a FCM token expire?(FCM 令牌何时到期?)
          <i id='e8Hmk'><tr id='e8Hmk'><dt id='e8Hmk'><q id='e8Hmk'><span id='e8Hmk'><b id='e8Hmk'><form id='e8Hmk'><ins id='e8Hmk'></ins><ul id='e8Hmk'></ul><sub id='e8Hmk'></sub></form><legend id='e8Hmk'></legend><bdo id='e8Hmk'><pre id='e8Hmk'><center id='e8Hmk'></center></pre></bdo></b><th id='e8Hmk'></th></span></q></dt></tr></i><div id='e8Hmk'><tfoot id='e8Hmk'></tfoot><dl id='e8Hmk'><fieldset id='e8Hmk'></fieldset></dl></div>
          <tfoot id='e8Hmk'></tfoot>
          <legend id='e8Hmk'><style id='e8Hmk'><dir id='e8Hmk'><q id='e8Hmk'></q></dir></style></legend>
              <tbody id='e8Hmk'></tbody>

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

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

                  本文介绍了FCM 令牌何时到期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  FCM 令牌何时到期?是6个月吗?

                  解决方案

                  不过它不会过期.如果发生以下情况之一,它会自行更新.

                  根据 https://firebase.google.com/docs/cloud-消息传递/android/客户端:

                  1. -应用删除Instance ID
                  2. -应用在新设备上恢复
                  3. -用户卸载/重新安装应用程序
                  4. -用户清除应用数据.

                  <块引用>

                  监控令牌生成

                  每当生成新令牌时都会触发 onTokenRefreshcallback,因此在其上下文中调用 getToken 可确保您正在访问一个当前可用的注册令牌.确保您已添加服务到您的清单,然后在上下文中调用 getTokenonTokenRefresh,并记录如下所示的值:

                  @Override公共无效 onTokenRefresh() {//获取更新的 InstanceID 令牌.字符串 refreshedToken = FirebaseInstanceId.getInstance().getToken();Log.d(TAG, "刷新令牌:" + refreshedToken);//如果要向此应用程序实例发送消息或//在服务器端管理此应用订阅,发送//实例 ID 令牌到您的应用服务器.sendRegistrationToServer(refreshedToken);}

                  编辑

                  onTokenRefresh() 现在已弃用.onNewToken()<应该使用/a>.

                  When do FCM tokens expire? Is it at 6 months?

                  解决方案

                  It doesn't expire though. It renews itself if one of the following happens.

                  According to https://firebase.google.com/docs/cloud-messaging/android/client:

                  1. -The app deletes Instance ID
                  2. -The app is restored on a new device
                  3. -The user uninstalls/reinstall the app
                  4. -The user clears app data.

                  Monitor token generation

                  The onTokenRefreshcallback fires whenever a new token is generated, so calling getToken in its context ensures that you are accessing a current, available registration token. Make sure you have added the service to your manifest, then call getToken in the context of onTokenRefresh, and log the value as shown:

                  @Override
                  public void onTokenRefresh() {
                      // Get updated InstanceID token.
                      String refreshedToken = FirebaseInstanceId.getInstance().getToken();
                      Log.d(TAG, "Refreshed token: " + refreshedToken);
                  
                      // If you want to send messages to this application instance or
                      // manage this apps subscriptions on the server side, send the
                      // Instance ID token to your app server.
                      sendRegistrationToServer(refreshedToken);
                  }
                  

                  EDIT

                  onTokenRefresh() is now deprecated. onNewToken() should be used instead.

                  这篇关于FCM 令牌何时到期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Firebase Cloud Messaging (FCM) - Launch Activity when user clicks the notification with extras(Firebase Cloud Messaging (FCM) - 当用户点击带有附加功能的通知时启动活动)
                  Implement Firebase inside of a Library(在库中实现 Firebase)
                  Firebase Backward compatibility with GCM(Firebase 与 GCM 的向后兼容性)
                  Receiving the FCM notifications multiple times on Nougat(在 Nougat 上多次接收 FCM 通知)
                  Push Notifications are delivered but didReceiveRemoteNotification is never called Swift(推送通知已交付,但 didReceiveRemoteNotification 从未被称为 Swift)
                  Firebase FCM MismatchSenderID(Firebase FCM 不匹配SenderID)
                  <tfoot id='gmldS'></tfoot>
                • <small id='gmldS'></small><noframes id='gmldS'>

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

                              <tbody id='gmldS'></tbody>