When using FirebaseMessaging#sendAll(List<Message>) or FirebaseMessaging#sendMulticast(MulticastMessage), the SDK returns a BatchResponse. This object contains the individual results for every message sent in the batch.
You can use BatchResponse to inspect which specific messages succeeded or failed and to get aggregate counts of successes and failures.
// Example of processing a BatchResponse
BatchResponse response = messaging.sendAll(messages);
int successes = response.getSuccessCount();
int failures = response.getFailureCount();
List<SendResponse> individualResponses = response.getResponses();
for (SendResponse res : individualResponses) {
if (!res.isSuccessful()) {
// Handle individual message failure
System.out.println("Message failed: " + res.getException().getMessage());
}
}