Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Usage of Azure Notification Hubs templateName

I've created a sample App with Cordova and a Mvc5 application that talks with Azure Notification Hubs. Registrations are handled by the backend because tags must be secured.

We have used three different templates registered from the backend for the iOS,WP8 and Android platforms; the backend can send a push notification with a $message payload using sendtemplatenotificationasync.

It's working but we have not used the templateName.

Reading the Registration from your app Backend documentation , I've found this:

"You can identify the templates by using the TemplateName property of the registration".

Once I have successfully created a Registration with a templateName what can I do with it?

I expected to find an API Send method to be able to specify, besides the tags or tag expression, a specific templateName; I have not found anything like this.

What's the meaning and the general use case of templateName?

like image 899
systempuntoout Avatar asked Aug 13 '14 09:08

systempuntoout


People also ask

What is azure notification hub used for?

Windows Azure Notification Hubs provide you with an extremely scalable push notification infrastructure that helps you efficiently route cross-platform, personalized push notification messages to millions of users: Device token management.

What is the resource structure of notification hubs?

What is the resource structure of Notification Hubs? Azure Notification Hubs has two resource levels: hubs and namespaces. A hub is a single push resource that can hold the cross-platform push information of one app. A namespace is a collection of hubs in one region.

Is Azure notification hub free?

Notification Hubs is offered in three tiers—free, basic and standard. Base charge and quotas are applied at the namespace level. Pushes exceeding included amounts are aggregated at the subscription level for each tier.

How do I make Azure notification hub?

Sign in to the Azure portal. Select All services on the left menu, search for Notification Hub, select star ( * ) next to Notification Hub Namespaces to add it to the FAVORITES section on the left menu. Select Notification Hub Namespaces. On the Notification Hub Namespaces page, select your namespace from the list.


1 Answers

The template name is just a descriptive label for the template registration. It is not intended to be used to programmatically identify registrations and therefore there aren't any API methods that use the template name. You shouldn't use it for anything other than debugging or logging. (I don't set template names at all...)

You can check the official ANH Java SDK on GitHub for example: If you search for "templatename", you won't find any usage other than setting the template name for a registration.

All your templates should use the same template parameters, if they are intended for the same notification type. Then you just send a template notification with all the parameters to all platforms at once. That is the use case for template registrations. As far as I know, you can have additional parameters for specific platforms, registrations that don't specify a parameter, just won't receive it. Just make sure you send all parameters that are defined in all templates.

If you wan't to distinguish between registrations with different templates, use tags, e.g. for distinguishing platforms use tags like "Platform:Android", "Platform:iOS", etc. Or for distinguishing templates with different parameters use "Template:PersonalMessage", "Template:GroupMessage", "Template:BroadCast", etc...

like image 193
Baris Akar Avatar answered Sep 21 '22 13:09

Baris Akar