Firebase CloudMessaging triggered from CloudCode

Hi,

Does anyone have any useful resources on how to set things up so that a CloudCode C# Module can trigger a push notification via Firebase Cloud Messaging to a specific user? I am building a turn-based game and need to alert players when an opponent has made a move. I don’t plan to use Unity Push Notifications at this stage due to Unity Analytics pricing and Push Notification limits.

For this specific use case we have Cloud Code Push Messages which is a direct push to a running game client. Check out this comment: Turn Changed

Hi. I’ve implemented pish messages already, but that only addresses the user case where the opponent is actively playing. I should probably have noted that this is a passive turn-based game, so I need to be able to alert the opponent when the game is backgrounded etc.

I see! In that case you would most likely use the Firebase Cloud Messaging NuGet package: NuGet Gallery | Google.Apis.FirebaseCloudMessaging.v1 1.68.0.3431

This would let your C# module send a cloud message. Here’s more info: Firebase Cloud Messaging API Client Library for .NET  |  Google for Developers

You would most likely need to obtain the user’s device id and store that in Cloud Save.