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
You could assign template body to corresponding property:
registration.BodyTemplate=new CDataMember(templateBody);
or just use constructor:
public GcmTemplateRegistrationDescription(string gcmRegistrationId, string jsonPayload)
where jsonPayload is your template body
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.