Reputation: 1091
I am following this Microsoft Guide to migrate from GCM/FCM notifications to FCM v1.
From the guide, I -
1.Configured the Firebase Service Account Credentials in Azure Notification Hub
2.Updaeted backend and app (Xamarin) to use FCM v1 platform during installation & registration of push notification -
/* Installation */
var installation = new Installation()
{
InstallationId = "installation-guid",
PushChannel = "firebase-token",
Platform = NotificationPlatform.FcmV1
};
installation.Tags = ... Assign tags;
installation.Templates[key] = "fcm v1 template";
hubClient.CreateOrUpdateInstallationAsync(installation);
/* Update Tag Based On User Id */
await hubClient.PatchInstallationAsync(installationId, new[]
{
new PartialUpdateOperation
{
Operation = UpdateOperationType.Replace,
Path = "/tags",
Value = userId.ToNotificationTag()
}
});
3.Verified that the device is actually registered in notification hub (by getting registrations from notification hub)
4.Verified that notification is delivered to app when sent from firebase console. (Using firebase token (value of PushChannel in installation object)
The problem is:
When sending notification from "Test Send" in Azure Portal, it does not get delivered and I can see error under 'FCM v1 Errors' metrics.
When sending template notification from code (C# - Microsoft.Azure.NotificationHubs nuget), it shows same error.
Here are some tracking id (I don't know how I can use those to get more information):
More information - After upgrading notification hub to standard tier, I got this telemerty details -
<?xml version="1.0" encoding="utf-16"?>
<PnsFeedback xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">
<FeedbackTime>2024-04-18T16:20:35.1678121Z</FeedbackTime>
<NotificationSystemError>UnknownError</NotificationSystemError>
<Platform>fcmV1</Platform>
<PnsHandle>eJpiCAulSye7BfsmmqZ6Dl:xxxxxx</PnsHandle>
<RegistrationId>7159908837859365990-7306945109327663386-8</RegistrationId>
<NotificationId>NH-20240418162035079-5f4b5669ff814d269738156327a12cc3-08</NotificationId>
</PnsFeedback>
and equvivalent registration -
{
"eTag": "4",
"expirationTime": "2024-04-18T16:16:32.7765811Z",
"registrationId": "7159908837859365990-7306945109327663386-8",
"tags": "$InstallationId:{6966898c-0231-4a23-ac96-77456ad5cc13},userId:12041U",
"fcmV1RegistrationId": "eJpiCAulSye7BfsmmqZ6Dl:xxxxxx",
"bodyTemplate": {
"value": "{\"message\":{\"android\":{\"data\":{\"message\":\"$(messageParam)\",\"attachmentLink\":\"$(attachmentLinkParam)\",\"thumbnailLink\":\"$(thumbnailLinkParam)\",\"type\":\"$(typeParam)\",\"additionalData\":\"$(additionalDataParam)\",\"toId\":\"$(toIdParam)\",\"isPublic\":\"$(isPublicParam)\"}}}}"
},
"templateName": "genericMessage"
}
Upvotes: 7
Views: 2742
Reputation: 1
We are in the same situation as Mr.comecme. We have asked Microsoft to investigate the cause, but a solution has not yet been reached. If you have resolved the issue, I would appreciate it if you could let me know how to do it.
Upvotes: 0
Reputation: 6386
We have the same problem, I think. We use templates. We've changed the call to installations to specify FCMv1 as the platform, and we've changed the template. When retrieving the installation, I see it is indeed registered on the NotificationHub.
When sending a template message via the messages REST API we use the test
querystring to get a NotificationOutcome. In that result, we always get a value of 0
for both Success and Failure.
It's just like the NotificationHub doesn't "see" the FCMv1 installations when it searches for installations to send the template message to.
Google Firebase has been configured correctly. When we send a direct FCMv1 message from the NotificationHub, to the same tag, the NotificationHub does show Success: 1 and the notification is actually received on the device. When we send a template message from the NotificationHub interface, to the same tag, it too show 0 for both success and failure.
Upvotes: 1
Reputation: 337
This is not the case with me. SendTemplateNotification does not work for me.
Upvotes: 0
Reputation: 1091
Ok, It seems everything was fine.. Except, we forgot to enable Firebase Messageing API on Google Cloud Console
Upvotes: 3