Closed jonasgoderis closed 3 years ago
I found a few problems with this issue:
The recommended ways to send messages to several users are:
This library already implements topic messaging, so you can leverage it as I did here to subscribe users to topics, and here to send a notif to multiple users
But this library doesn't implement device group messaging. So, based on Google's documentation, I made an implementation of Device group messaging in C#. Which is available here, I tested it and it works fine. There is a little API attached to the project, which you can use to test it by yourself.
I also opened an issue here, since I'm planning to make a PR that includes Device group messaging.
@DamienDoumer thank you for your advice regarding how to send messages to several users, will definitely take a look into that! Much appreciated!
Just wondering then in which case(s) the method SendMulticastAsync
should be used then?
SendMulticastAsync is still used to send multiple messages, but topic messaging is the recommended way. I don't have any reference right now, but if I get I'll add it here.
@DamienDoumer is correct. topic messaging is the recommended way.
Just catching up to this issue. Here are my thoughts on this:
GOOGLE_APPLICATION_CREDENTIALS
environment variable to get app default credentials working locally (see https://firebase.google.com/docs/admin/setup#initialize-sdk).Update: Also note that for this use case to work as intended, you might have to set the quota project on the GoogleCredential
object it self. See https://github.com/googleapis/google-api-dotnet-client/blob/master/Src/Support/Google.Apis.Auth/OAuth2/GoogleCredential.cs#L296-L307
Environment
The problem
We're developing a .NET Core API for a new mobile applicatione. One of the features is sending Push Notifications from the API. To make connection with all our Google Services and Firebase Cloud Messaging we're making use of APPLICATION DEFAULT CREDENTIALS. This is not done via a environment variable but with logging in with following command.
gcloud auth application-default login
When doing the initial setup we encountered a problem that had the following error message.
Eventually this problem was resolved by setting the
billing/quota_project
in my config by running following command.gcloud auth application-default set-quota-project my-project
Sending single push notifications was no problem and everything was implemented very quickly.
Now we were up to sending push notifications to a batch of devices (tokens). Therefore we are using the method
SendMulticastAsync
to send a single message to different devices, underlying this method is usingSendAllAsync
.When we implemented this in our API we noticed that none of the messages was sent. When digging a bit deeper we saw that the reason for this was following error which is the same as we encountered during setup. The strange thing is that the single notification is still working.
I already pulled my hair out finding the solution for this but after hours of searching didn't came up with a solution. No idea if I'm doing something wrong or there's some bug. But I do hope you guys can help out :)
Relevant Code: