1

I'm trying to register a template in the Azure Notification Hub from my App Backend but there's no documentation on how to actually do that and no documentation of the used classes.

I'm trying to create a RegistrationDescription which should create the template I created for GCM:

{
"data": {
    "msg": "$(property1)"
}
}

Therefore, I'm trying to use a GcmTemplateRegistrationDescription object (http://msdn.microsoft.com/en-us/library/microsoft.servicebus.notifications.gcmtemplateregistrationdescription.aspx) . However I don't see where I can inject the template into this object.

Registering to the hub should be easy after being able to create the GcmTemplateRegistrationDescription and should look like this:

       NotificationHubClient hub = GetHubFromConfig();  
       GcmTemplateRegistrationDescription registration = CreateRegistration();

       hub.CreateOrUpdateRegistrationAsync(registration); 

How can I inject the template in the hub? Is there a completely different way to do this?

Thanks

4

1 回答 1

0

您可以将模板主体分配给相应的属性:

registration.BodyTemplate=new CDataMember(templateBody);

或者只使用构造函数:

public GcmTemplateRegistrationDescription(string gcmRegistrationId, string jsonPayload)

其中 jsonPayload 是您的模板主体

于 2014-08-23T22:01:55.600 回答