0

由于通知失败的默认退避/重试,我的线程保持阻塞的时间更长,这会影响我的应用程序的正流。我不希望重试或最小化它。用于创建 FirebaseApp 的逻辑是:

FileInputStream serviceAccount = new FileInputStream("fileName");
FirebaseOptions options = new FirebaseOptions.Builder()
  .setCredentials(GoogleCredentials.fromStream(serviceAccount))
  .build();

FirebaseApp app  = FirebaseApp.initializeApp(options, vendorId);

之后,我设置数据并向 FCM 服务器发送请求:

Message.Builder builder = Message.builder
          .setToken(fcmToken);

//put required payload data       
builder.putData("key", "value");

//Added android Configs
AndroidConfig androidConfigs = AndroidConfig.builder()
              .setTtl(30000)
              .setPriority(AndroidConfig.Priority.HIGH)
              .build();
builder.setAndroidConfig(androidConfigs);

//sending request to FCM
app.sendAsync(builder.build(), false);

我读了一个建议,有人告诉我Retry-After标题会对此有所帮助,我不确定在我的代码中添加到哪里。请建议我,提前谢谢。

4

0 回答 0