Can't send notifications using FCM Admin SDK for Java

231 views
Skip to first unread message

Soumojit

unread,
Jan 7, 2022, 4:10:19 PM1/7/22
to Firebase Google Group
I am not able to send notifications using the Firebase Admin SDK for Java. I'm using a React-based web app as a recipient of the notifications. I don't see any errors or exceptions when I call the method FirebaseMessaging.getInstance().send(message), I am seeing a response indicating success (a message ID is returned). But the notification is never showing up on the web app which I registered with FCM. I am able to send notifications to the app using the Firebase Console as well as through making direct API calls to https://fcm.googleapis.com/fcm/send

Only when I use the Java Admin SDK, the notifications are not showing up on the app. Let me paste a couple of responses that I got while calling the send() method of the SDK:
  • When targetting a specific FCM device registration token: "projects/test-browser-a3949/messages/b2b7fed9-6b50-41ee-823d-4b9f55ebc724"
  • When targetting a topic in FCM: "projects/test-browser-a3949/messages/3544288717730144775"
In either case, I don't see these messages logged anywhere in the Firebase Console using the message ID's.

Also, I noticed that the following parameters are not getting read from the JSON file with the details about the service account:
  • private_key
  • private_key_id
  • client_id
  • client_x509_cert_url
I concluded this by editing the JSON file and putting garbage values for those fields and still seeing a successful response from the send() method call.

I have attached my updated code with this email. Any idea what could be the issue?

Thanks,
Soumojit
FCMController.txt
Reply all
Reply to author
Forward
0 new messages