SlideShare a Scribd company logo
Google DevFest MN - Windows Azure Notification Hubs
Me
adam grocholski

adgroc@microsoft.com
@codel8r
thinkfirstcodelater.com
Google DevFest MN - Windows Azure Notification Hubs
Google DevFest MN - Windows Azure Notification Hubs
Google DevFest MN - Windows Azure Notification Hubs
Google DevFest MN - Windows Azure Notification Hubs
Google DevFest MN - Windows Azure Notification Hubs
Google DevFest MN - Windows Azure Notification Hubs
Google DevFest MN - Windows Azure Notification Hubs
Google DevFest MN - Windows Azure Notification Hubs
Google DevFest MN - Windows Azure Notification Hubs
Google DevFest MN - Windows Azure Notification Hubs
Client app

Platform
Notification
Service

App back-end
Google DevFest MN - Windows Azure Notification Hubs
Android app

Windows Store
app

App back-end

GCM

Notification Hub

WNS
Google DevFest MN - Windows Azure Notification Hubs
Google DevFest MN - Windows Azure Notification Hubs
//get the gcm id
GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(context);
String gcmid = gcm.register(SENDER_ID);
//instantiate a new NotificationHub instance

NotificationHub hub = new NotificationHub("<hub name>", "<connection
string>", context);
//register with the NotificationHub
NativeRegistration r = hub.register(gcmid);
//instantiate a new instance of NotificationHubClient
var hubClient =
NotificationHubClient.CreateClientFromConnectionString("<connection
string>", "<hub name>");
//create the json payload for the notification
var payload = "{ "data" : {"msg":"Hello from Windows Azure!"}}";

//send notification via gcm
hubClient.SendGcmNativeNotificationAsync(payload);
No need to store and maintain gcmId.
Device registrations expire.
Google DevFest MN - Windows Azure Notification Hubs
App back-end
Tag:”Beatles”

Notification Hub

Tag:”Wailers”

Tag:”Beatles”
//get the gcm id
GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(context);
String gcmid = gcm.register(SENDER_ID);
//instantiate a new NotificationHub instance

NotificationHub hub = new NotificationHub("<hub name>", "<connection
string>", context);
//register with the NotificationHub using tags
NativeRegistration r = hub.register(gcmid, "Beatles");
//instantiate a new instance of NotificationHubClient
var hubClient =
NotificationHubClient.CreateClientFromConnectionString("<connection
string>", "<hub name>");
//create the json payload for the notification
var payload = "{ "data" : {"msg":"Hello from Windows Azure!"}}";

//create a list of tags
var tags = new List<string>(){ "Beatles" };
//send notification to devices registered with tags via gcm

hubClient.SendGcmNativeNotificationAsync(payload, tags);
Google DevFest MN - Windows Azure Notification Hubs
Google DevFest MN - Windows Azure Notification Hubs
Notification Hub
App back-end
Google DevFest MN - Windows Azure Notification Hubs
Google DevFest MN - Windows Azure Notification Hubs
<toast>
<visual>
<binding template="ToastText01">
<text id="1">$(message)</text>
</binding>
</visual>
</toast>

Hello!
{ message: “Hello!” }

App back-end

Service Bus
Notification Hub
Hello!

{
aps: {
alert: “$(message)”
}
}
<toast>
<visual>
<binding template="ToastText01">
<text id="1">$(tempF)</text>
</binding>
</visual>
</toast>

73
{tempC: “23”, tempF: “73”}

App back-end

Service Bus
Notification Hub
23

{
aps: {
alert: “$(tempC)”
}
}
//get the gcm id
GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(context);
String gcmid = gcm.register(SENDER_ID);

//instantiate a new NotificationHub instance
NotificationHub hub = new NotificationHub("<hub name>", "<connection
string>", context);
//create the template
String template = "{ "data" : {"msg":"$(message)"}}";
//register with the NotificationHub using the template
NativeRegistration r = hub.register(gcmid, "Template1", template, "Beatles");
//instantiate a new instance of NotificationHubClient
var hubClient =
NotificationHubClient.CreateClientFromConnectionString("<connection
string>", "<hub name>");
//create expressions to substitute in the template
var expressions = var Dictionary<string, string>();
expressions.Add("message", "hello");

//send template notification to all devices
hubClient.SendTemplateNotificationAsync(expressions);
Google DevFest MN - Windows Azure Notification Hubs
Google DevFest MN - Windows Azure Notification Hubs
Google DevFest MN - Windows Azure Notification Hubs
Google DevFest MN - Windows Azure Notification Hubs
Google DevFest MN - Windows Azure Notification Hubs
What Next?
Try it out. For Free.
Build what you want. Scale as you need. Full access with no strings
attached.

http://aka.ms/thecloud

Hello startups!
You have an ideas so brilliant it burns. BizSpark can help make it real.

http://aka.ms/JoinBizSpark or CONTACT ME!
Contact Me
adam grocholski

adgroc@microsoft.com
@codel8r
thinkfirstcodelater.com
Google DevFest MN - Windows Azure Notification Hubs

More Related Content

TXT
Penjualan swalayan
DOCX
Exchange 2010/2013 Exchange Management Shell Command
PPTX
Asynchronous programming from Xamarin Hakcday in Melbourne
DOCX
Oop lab report
PDF
Clojure functions 4
PPTX
Azure sql insert perf
PDF
The Ring programming language version 1.10 book - Part 51 of 212
PDF
The Ring programming language version 1.2 book - Part 29 of 84
Penjualan swalayan
Exchange 2010/2013 Exchange Management Shell Command
Asynchronous programming from Xamarin Hakcday in Melbourne
Oop lab report
Clojure functions 4
Azure sql insert perf
The Ring programming language version 1.10 book - Part 51 of 212
The Ring programming language version 1.2 book - Part 29 of 84

What's hot (6)

PDF
Будь первым
DOCX
bank management system
PDF
All you need to know about Callbacks, Promises, Generators
PDF
Jeroen Vloothuis Bend Kss To Your Will
PDF
The Ring programming language version 1.5.2 book - Part 40 of 181
PDF
Curlin' for Docs
Будь первым
bank management system
All you need to know about Callbacks, Promises, Generators
Jeroen Vloothuis Bend Kss To Your Will
The Ring programming language version 1.5.2 book - Part 40 of 181
Curlin' for Docs
Ad

Similar to Google DevFest MN - Windows Azure Notification Hubs (20)

PPTX
Azure notification hubs
PPTX
St. Louis Day of .NET 2013 - Delivering Push Notifications to Millions of Mob...
PDF
Cross Platform Mobile Push Notifications with Azure Notifications Hub
PPTX
Scaling push notifications to millions of devices using notification hubs
PPTX
Mobile March Windows Azure Notification Hubs
PPTX
google cloud messaging
PDF
A Journey into Google Cloud Messaging
PPTX
Firebase Cloud Messaging
PPTX
GCM Android
PPTX
GCM Technology for Android
PDF
GOOGLE CLOUD MESSAGING (GCM): A LIGHT WEIGHT COMMUNICATION MECHANISM BETWEEN ...
PDF
GOOGLE CLOUD MESSAGING (GCM): A LIGHT WEIGHT COMMUNICATION MECHANISM BETWEEN ...
PDF
Push to Me: Mobile Push Notifications (Zend Framework)
ODP
Push notifications presentation
PPT
Colombo Mobile Developer MeetUp - Building Scalable Cloud Connected Mobile Ap...
PPTX
Delivering Millions of Push Notifications in Minutes
PPTX
Gcm presentation
PPTX
Azure Notification hub
PPTX
Push it! How to use Google Cloud Messaging in your Android App
PPTX
Hybrid organization building modern business apps with windows azure notifica...
Azure notification hubs
St. Louis Day of .NET 2013 - Delivering Push Notifications to Millions of Mob...
Cross Platform Mobile Push Notifications with Azure Notifications Hub
Scaling push notifications to millions of devices using notification hubs
Mobile March Windows Azure Notification Hubs
google cloud messaging
A Journey into Google Cloud Messaging
Firebase Cloud Messaging
GCM Android
GCM Technology for Android
GOOGLE CLOUD MESSAGING (GCM): A LIGHT WEIGHT COMMUNICATION MECHANISM BETWEEN ...
GOOGLE CLOUD MESSAGING (GCM): A LIGHT WEIGHT COMMUNICATION MECHANISM BETWEEN ...
Push to Me: Mobile Push Notifications (Zend Framework)
Push notifications presentation
Colombo Mobile Developer MeetUp - Building Scalable Cloud Connected Mobile Ap...
Delivering Millions of Push Notifications in Minutes
Gcm presentation
Azure Notification hub
Push it! How to use Google Cloud Messaging in your Android App
Hybrid organization building modern business apps with windows azure notifica...
Ad

Recently uploaded (20)

PDF
Electronic commerce courselecture one. Pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Approach and Philosophy of On baking technology
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
KodekX | Application Modernization Development
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Spectroscopy.pptx food analysis technology
Electronic commerce courselecture one. Pdf
20250228 LYD VKU AI Blended-Learning.pptx
The AUB Centre for AI in Media Proposal.docx
Spectral efficient network and resource selection model in 5G networks
Advanced methodologies resolving dimensionality complications for autism neur...
“AI and Expert System Decision Support & Business Intelligence Systems”
Network Security Unit 5.pdf for BCA BBA.
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Approach and Philosophy of On baking technology
Understanding_Digital_Forensics_Presentation.pptx
NewMind AI Weekly Chronicles - August'25 Week I
Unlocking AI with Model Context Protocol (MCP)
Mobile App Security Testing_ A Comprehensive Guide.pdf
Chapter 3 Spatial Domain Image Processing.pdf
KodekX | Application Modernization Development
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Review of recent advances in non-invasive hemoglobin estimation
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Spectroscopy.pptx food analysis technology

Google DevFest MN - Windows Azure Notification Hubs

  • 15. Android app Windows Store app App back-end GCM Notification Hub WNS
  • 18. //get the gcm id GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(context); String gcmid = gcm.register(SENDER_ID); //instantiate a new NotificationHub instance NotificationHub hub = new NotificationHub("<hub name>", "<connection string>", context); //register with the NotificationHub NativeRegistration r = hub.register(gcmid);
  • 19. //instantiate a new instance of NotificationHubClient var hubClient = NotificationHubClient.CreateClientFromConnectionString("<connection string>", "<hub name>"); //create the json payload for the notification var payload = "{ "data" : {"msg":"Hello from Windows Azure!"}}"; //send notification via gcm hubClient.SendGcmNativeNotificationAsync(payload);
  • 20. No need to store and maintain gcmId. Device registrations expire.
  • 23. //get the gcm id GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(context); String gcmid = gcm.register(SENDER_ID); //instantiate a new NotificationHub instance NotificationHub hub = new NotificationHub("<hub name>", "<connection string>", context); //register with the NotificationHub using tags NativeRegistration r = hub.register(gcmid, "Beatles");
  • 24. //instantiate a new instance of NotificationHubClient var hubClient = NotificationHubClient.CreateClientFromConnectionString("<connection string>", "<hub name>"); //create the json payload for the notification var payload = "{ "data" : {"msg":"Hello from Windows Azure!"}}"; //create a list of tags var tags = new List<string>(){ "Beatles" }; //send notification to devices registered with tags via gcm hubClient.SendGcmNativeNotificationAsync(payload, tags);
  • 30. <toast> <visual> <binding template="ToastText01"> <text id="1">$(message)</text> </binding> </visual> </toast> Hello! { message: “Hello!” } App back-end Service Bus Notification Hub Hello! { aps: { alert: “$(message)” } }
  • 31. <toast> <visual> <binding template="ToastText01"> <text id="1">$(tempF)</text> </binding> </visual> </toast> 73 {tempC: “23”, tempF: “73”} App back-end Service Bus Notification Hub 23 { aps: { alert: “$(tempC)” } }
  • 32. //get the gcm id GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(context); String gcmid = gcm.register(SENDER_ID); //instantiate a new NotificationHub instance NotificationHub hub = new NotificationHub("<hub name>", "<connection string>", context); //create the template String template = "{ "data" : {"msg":"$(message)"}}"; //register with the NotificationHub using the template NativeRegistration r = hub.register(gcmid, "Template1", template, "Beatles");
  • 33. //instantiate a new instance of NotificationHubClient var hubClient = NotificationHubClient.CreateClientFromConnectionString("<connection string>", "<hub name>"); //create expressions to substitute in the template var expressions = var Dictionary<string, string>(); expressions.Add("message", "hello"); //send template notification to all devices hubClient.SendTemplateNotificationAsync(expressions);
  • 39. What Next? Try it out. For Free. Build what you want. Scale as you need. Full access with no strings attached. http://aka.ms/thecloud Hello startups! You have an ideas so brilliant it burns. BizSpark can help make it real. http://aka.ms/JoinBizSpark or CONTACT ME!