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

  • <legend id='KJTbS'><style id='KJTbS'><dir id='KJTbS'><q id='KJTbS'></q></dir></style></legend>

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

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

        何时创建 fcm 刷新令牌

        时间:2023-07-28
        • <bdo id='2YnGj'></bdo><ul id='2YnGj'></ul>
          <i id='2YnGj'><tr id='2YnGj'><dt id='2YnGj'><q id='2YnGj'><span id='2YnGj'><b id='2YnGj'><form id='2YnGj'><ins id='2YnGj'></ins><ul id='2YnGj'></ul><sub id='2YnGj'></sub></form><legend id='2YnGj'></legend><bdo id='2YnGj'><pre id='2YnGj'><center id='2YnGj'></center></pre></bdo></b><th id='2YnGj'></th></span></q></dt></tr></i><div id='2YnGj'><tfoot id='2YnGj'></tfoot><dl id='2YnGj'><fieldset id='2YnGj'></fieldset></dl></div>

            <tfoot id='2YnGj'></tfoot>
              <legend id='2YnGj'><style id='2YnGj'><dir id='2YnGj'><q id='2YnGj'></q></dir></style></legend>
                  <tbody id='2YnGj'></tbody>

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

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

                  问题描述

                  我是 android 新手,现在正在寻找 firebase.在我的应用程序中可以登录多个手机号码.所以我正在做的是删除当前令牌

                  I'm new to android and now looking on firebase.In my app multiple mobile numbers can be logged in. So what am doing is deleting current token by

                  FirebaseInstanceId.getInstance().deleteInstanceId();
                  

                  然后当我用新号码登录时,就会生成新的令牌.

                  and after that when I log in with new number, then new token gets generated.

                  所以我的问题是哪个事件触发了令牌再生事件.上面代码行的另一件事是我必须在线程(除了主线程)上运行才能工作

                  So my question in this exactly which event triggers token regeneration event. One more thing that above code line should I have to run on thread (other than MAIN THREAD) to work

                  推荐答案

                  这是我用来获取firebase令牌的服务

                  This is the service which I used for getting firebase token

                      public class FCMInstanceIDListenerService extends FirebaseInstanceIdService {
                  AppSharedPreferences appSharedPreferences;
                      @Override
                      public void onCreate() {
                          super.onCreate();
                          String CurrentToken = FirebaseInstanceId.getInstance().getToken();
                          if (CurrentToken!=null){
                              Intent intent = new Intent("device_id");
                              LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
                              Log.d("token", "Refreshed token: " + CurrentToken);
                              appSharedPreferences.putString("device_id",CurrentToken);
                          }
                          else {
                                 onTokenRefresh();
                                  }
                         }
                  
                      public FCMInstanceIDListenerService() {
                  
                          appSharedPreferences=AppSharedPreferences.getsharedprefInstance(this);
                          // prefManager = PrefManager.getInstance(this);
                      }
                  
                      @Override
                      public void onTokenRefresh() {
                          super.onTokenRefresh();
                          String refreshedToken = FirebaseInstanceId.getInstance().getToken();
                          Intent intent = new Intent("device_id");
                          LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
                          Log.d("token", "Refreshed token: " + refreshedToken);
                          appSharedPreferences.putString("device_id",refreshedToken);
                          // prefManager.putString(PrefrenceConstants.KEY_DEVICE_ID, refreshedToken);
                  
                      }
                  
                  }
                  

                  来自 开发者网站:

                  onTokenRefresh() 当系统确定令牌需要刷新.应用程序应该调用 getToken() 并发送所有应用服务器的令牌.

                  onTokenRefresh() Called when the system determines that the tokens need to be refreshed. The application should call getToken() and send the tokens to all application servers.

                  这个不会被频繁调用,key轮换需要用到并处理由于以下原因导致的实例 ID 更改:

                  This will not be called very frequently, it is needed for key rotation and to handle Instance ID changes due to:

                  • 应用删除实例 ID

                  • App deletes Instance ID

                  应用在新设备上恢复

                  用户卸载/重新安装应用

                  User uninstalls/reinstall the app

                  用户清除应用数据

                  系统将限制所有设备的刷新事件以避免使用令牌更新重载应用程序服务器.

                  The system will throttle the refresh event across all devices to avoid overloading application servers with token updates.

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

                  上一篇:Firebase 通知 - 注册令牌无效,请检查 Android 中的令牌格式 下一篇:当应用程序在后台时,FCM 无法显示弹出窗口

                  相关文章

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

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

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