Azure Notification Hub not returning FCM tags

Viewed 90

I'm following the Microsoft Push Notification tutorial and am getting unexpected results for Android devices registered.

Code used to register devices:

public async Task<bool> CreateOrUpdateInstallationAsync(DeviceInstallation deviceInstallation, CancellationToken token)
        {
            if (deviceInstallation == null)
            {
                throw new ArgumentException(nameof(deviceInstallation));
            }
            if (string.IsNullOrWhiteSpace(deviceInstallation?.InstallationId))
            {
                throw new ArgumentException("InstallationId cannot be null or blank");
            }
            if (string.IsNullOrWhiteSpace(deviceInstallation?.Platform))
            {
                throw new ArgumentException("Platform cannot be null or blank");
            }
            if (string.IsNullOrWhiteSpace(deviceInstallation?.PushChannel))
            {
                throw new ArgumentException("PushChannel cannot be null or blank");
            }

            var installation = new Installation()
            {
                InstallationId = deviceInstallation.InstallationId,
                PushChannel = deviceInstallation.PushChannel,
                Tags = deviceInstallation.Tags
            };

            if (_installationPlatform.TryGetValue(deviceInstallation.Platform, out var platform))
            {
                installation.Platform = platform;
            }
            else
            {
                throw new InvalidPlaformException("The mobile platform is invalid: " + deviceInstallation.Platform);
            }

            try
            {
                await _hub.CreateOrUpdateInstallationAsync(installation, token);
            }
            catch (Exception ex)
            {
                throw new AzurePushNotificationInstallationException("There was an error installing the deivce in Azure Notification Hub: " + deviceInstallation.PushChannel, ex);
            }

            return true;
        }

This works fine for iOS. The issue is that when I call GetAllRegistrationsAsync, I am not getting any tags for FCM.

//iOS Deice
{
    "eTag": "1",
    "expirationTime": "9999-12-31T23:59:59.9999999Z",
    "registrationId": "<removed>",
    "tags": [
      "$InstallationId:{<removed>}",
      "AccountID:2"
    ],
    "pushVariables": null,
    "pnsHandle": "<removed>",
    "isReadOnly": false,
    "extensionData": {}
  },
// Android Device
  {
    "eTag": "1",
    "expirationTime": "9999-12-31T23:59:59.9999999Z",
    "registrationId": "<removed>",
    "tags": [],
    "pushVariables": null,
    "pnsHandle": "<removed>",
    "isReadOnly": false,
    "extensionData": {}
  },

I can send notifications to the Android device using the AccountID tag, which I don't see being returned.

I would suspect that the FCM registration would at least have $InstallationId. Is the normal behavior for FCM tags?

0 Answers
Related