Backend code still sends notification to gcm instead of fcm v1 using notificationHubClient.SendFcmNativeNotificationAsync

Yogini 0 Reputation points
2024-06-20T07:24:14.9633333+00:00

Hello,

I am able to register the device for FCM V1, once I get the notification token, I can send the test notification using azure hub overview -> Test Send option with format

`

{ "message": { "notification": { "body" : "message body"} } }

But when same message I send from my backend using

notificationHubClient.SendFcmNativeNotificationAsync method, it always goes to gcm and I'm getting error,

Microsoft.Azure.NotificationHubs.Messaging.BadRequestException: The notification has no target applications. The notification format is gcm. Review the credentials specified in the notification hub description and the notification format

Am I missing any configuration at backend / Azure hub?

Azure Notification Hubs
Azure Notification Hubs
An Azure service that is used to send push notifications to all major platforms from the cloud or on-premises environments.
325 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Marcel Gille 20 Reputation points
    2024-06-20T08:47:58.99+00:00

    Make sure you have the newest Package installed (4.2.0) and you have to use the notificationHubClient.SendFcmV1NativeNotificationAsync() Function.

    The V1 can be easily missed.

    2 people found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.