简体   繁体   中英

Why are Azure Notification Hub tags not saving?

I am trying to send a message to notification hub, but my tags are not saving.

I checked service hub with service hub explorer, and tags are empty: 在此处输入图片说明

Registration of device:

var hs = new HashSet<string>();
        hs.Add(tag);
        hs.Add(sys.ToString());
        switch (sys)
        {
            case SystemVendorEnum.Android:
                await Hub.CreateGcmNativeRegistrationAsync(pnsHandle, hs);
                break;
            case SystemVendorEnum.Ios:
                await Hub.CreateAppleNativeRegistrationAsync(pnsHandle, hs);
                break;
        }

Test method invocation that sends message to hub:

// param1: json payload, param2: tag
await Hub.SendGcmNativeNotificationAsync("{ \"data\": { \"methodId\":\"1\" }}", "ae65d2d5-103e-4023-a784-c5c8e2684db0");

Is there anything I am missing? I don't have tags in notification hub: 在此处输入图片说明

Is that the case?

I know, it's confusing, but there're two completely separate kinds of tags that have have no relationship to each other whatsoever:

  1. Tags that are within the context of Azure Notification Hub service. Those apply to device registrations. So, it's Notification Hubs service -specific and describes devices. See Routing and Tag Expressions for more details.
  2. Tags that as a concept of Azure Resource Manager (ARM). Those apply to any resource within Azure. So it's platform -specific and are used to describe any resource/service you have within Azure. See Using tags to organize your Azure resources for more details.

So when you call hs.Add(tag) , the associated tags apply to the device registration (ie 'tags of the first kind') and should show up in the Service Bus explorer: 在此处输入图片说明

And if you go to Azure portal and navigate to any resource (or as you did, to your hub), you'll see ARM tags there (ie 'tags of the second kind'): 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM