使用fcm admin skd for Java时如何启用日志以查看请求和响应

时间:2019-07-12 16:22:40

标签: firebase firebase-cloud-messaging

使用FCM admin SDK发送推送通知时,我们如何记录请求和响应负载?

这就是我的代码-

FirebaseOptions options = new FirebaseOptions.Builder()
           .setCredentials(GoogleCredentials.fromStream(serviceAccount))
            .setDatabaseUrl("https://myapp-main-app.firebaseio.com")
            .build();
FirebaseApp firebaseApp = FirebaseApp.initializeApp(options);

Notification notification = new Notification("Silly","ha ha");
        Message message = Message.builder()
            .setNotification(notification)
            .putData("score", "850")
            .setToken(registrationToken)
            .build();
FirebaseMessaging instance = FirebaseMessaging.getInstance(firebaseApp);

BatchResponse batchResponse = instance.sendAll(Arrays.asList(message));

0 个答案:

没有答案