skip to Main Content

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)
Registration Description Json 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:

  1. When sending notification from "Test Send" in Azure Portal, it does not get delivered and I can see error under ‘FCM v1 Errors’ metrics.
    Notification failed from Azure Portal

  2. When sending template notification from code (C# – Microsoft.Azure.NotificationHubs nuget), it shows same error.
    Code to send template notification

Here are some tracking id (I don’t know how I can use those to get more information):

  • eba8824d-6625-46ca-aa4c-b89cf4fbf9a3
  • d1638928-dc27-49ee-a4ee-2ccc1451acb6
  • 58e2b6b4-1075-465a-9f17-1d6810e6d9b4
  • 0d62ae4c-495c-4da5-8bbe-ed1b43d00413

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"
    }

2

Answers


  1. Chosen as BEST ANSWER

    Ok, It seems everything was fine.. Except, we forgot to enable Firebase Messageing API on Google Cloud Console


  2. This is not the case with me.
    SendTemplateNotification does not work for me.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search