• <legend id='ExEkh'><style id='ExEkh'><dir id='ExEkh'><q id='ExEkh'></q></dir></style></legend>
    <tfoot id='ExEkh'></tfoot>

        <bdo id='ExEkh'></bdo><ul id='ExEkh'></ul>
    1. <small id='ExEkh'></small><noframes id='ExEkh'>

      <i id='ExEkh'><tr id='ExEkh'><dt id='ExEkh'><q id='ExEkh'><span id='ExEkh'><b id='ExEkh'><form id='ExEkh'><ins id='ExEkh'></ins><ul id='ExEkh'></ul><sub id='ExEkh'></sub></form><legend id='ExEkh'></legend><bdo id='ExEkh'><pre id='ExEkh'><center id='ExEkh'></center></pre></bdo></b><th id='ExEkh'></th></span></q></dt></tr></i><div id='ExEkh'><tfoot id='ExEkh'></tfoot><dl id='ExEkh'><fieldset id='ExEkh'></fieldset></dl></div>
      1. 如何使用 Firebase 17.0.1 执行 INSTANCE_ID_EVENT 操作?

        时间:2023-07-29

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

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

            • <tfoot id='yFTa8'></tfoot>

                <i id='yFTa8'><tr id='yFTa8'><dt id='yFTa8'><q id='yFTa8'><span id='yFTa8'><b id='yFTa8'><form id='yFTa8'><ins id='yFTa8'></ins><ul id='yFTa8'></ul><sub id='yFTa8'></sub></form><legend id='yFTa8'></legend><bdo id='yFTa8'><pre id='yFTa8'><center id='yFTa8'></center></pre></bdo></b><th id='yFTa8'></th></span></q></dt></tr></i><div id='yFTa8'><tfoot id='yFTa8'></tfoot><dl id='yFTa8'><fieldset id='yFTa8'></fieldset></dl></div>
                    <tbody id='yFTa8'></tbody>
                • <legend id='yFTa8'><style id='yFTa8'><dir id='yFTa8'><q id='yFTa8'></q></dir></style></legend>
                • 本文介绍了如何使用 Firebase 17.0.1 执行 INSTANCE_ID_EVENT 操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  所以现在 FirebaseInstanceIdService 服务已被弃用,我不确定用什么替换它.

                  So now that the FirebaseInstanceIdService service is deprecated I'm unsure what to replace it with.

                  我之前在清单中声明了一个服务,如下所示:

                  I previously had a service declared in the manifest like so:

                          <service
                              android:name=".fcm.FcmIdService">
                              <intent-filter>
                                  <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
                              </intent-filter>
                          </service>
                  

                  还有服务本身:

                  public class FcmIdService extends FirebaseInstanceIdService {
                  
                      @Override
                      public void onTokenRefresh() {
                          // Create notification channel.
                          createFcmNotificationChannel();
                      }
                  
                  }
                  

                  如果我删除该服务,我将不再收到通知,所以我假设我必须用其他东西替换它.

                  If I remove the service I no longer receive notifications so I'm assuming I have to replace it with something else.

                  谢谢.

                  这个问题与提议的重复问题不同,它还涵盖了受影响服务的清单声明,这对我来说仍然不清楚.

                  This question differs from the proposed duplicate question by also covering the manifest declaration of the affected services which is still unclear to me.

                  推荐答案

                  查看这个话题:

                  FirebaseInstanceIdService 已弃用

                  您必须将其替换为:

                  public class MyFirebaseMessagingService extends FirebaseMessagingService {
                  
                          @Override
                          public void onNewToken(String s) {
                              super.onNewToken(s);
                              Log.e("NEW_TOKEN",s);
                          }
                  
                          @Override
                          public void onMessageReceived(RemoteMessage remoteMessage) {
                              super.onMessageReceived(remoteMessage);
                          }
                      }
                  

                  在清单中:

                  <service
                      android:name=".MyFirebaseMessagingService"
                      android:stopWithTask="false">
                      <intent-filter>
                  
                          <action android:name="com.google.firebase.MESSAGING_EVENT" />
                      </intent-filter>
                  </service>
                  

                  如果你想在项目的某个地方获取令牌:

                  And if you want to get token somewhere in your project:

                  FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener( MyActivity.this,  new OnSuccessListener<InstanceIdResult>() {
                       @Override
                       public void onSuccess(InstanceIdResult instanceIdResult) {
                             String newToken = instanceIdResult.getToken();
                             Log.e("newToken",newToken);
                  
                       }
                   }); 
                  

                  没有必要使用

                  <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
                  

                  希望对你有帮助

                  这篇关于如何使用 Firebase 17.0.1 执行 INSTANCE_ID_EVENT 操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Firebase 推送通知 下一篇:在没有用户点击通知的情况下处理数据负载?

                  相关文章

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

                      <bdo id='H4rrG'></bdo><ul id='H4rrG'></ul>
                    <tfoot id='H4rrG'></tfoot>

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