Delivering push notifications to
millions of mobile devices
adgroc@microsoft.com
@codel8r
thinkfirstcodelater.com
Me
adam grocholski
Notification Hubs…
…any easy way to send
personalized notifications both to
single users and very large
groups…
…regardless of platform.
Agenda
Push notifications
Notification hubs
Tags
Templates
Why Push?
Push is essential to the user experience of many apps.
Real world apps have complex needs.
Push notifications
Push notifications require a platform specific service.
An e2e solution requires lots of back-end code.
Push notification lifecycle
Registration at app launch
Sending notification
Maintenance
Platform
Notification
Service
App back-end
Client app
Challenges of push notifications
Platform dependency
Routing
Scale
Why Notification Hubs?
One-time set up
Register
Send Notification
GCM WNS
Notification Hub
App back-end
Android app Windows Store
app
Advantages of using Notification Hubs
No platform-specific protocols.
Avoid storing device information in the app back-end.
Broadcast
Sending notifications to specific
devices
Tags as interest groups.
You can use tags also for: Notification Hub
App back-end
Tag:”Beatles”Tag:”Wailers”
Tag:”Beatles”
Using templates for multi-platform
push
Registration.
Send notification.
Version independence.
Service Bus
Notification HubApp back-end
<toast>
<visual>
<binding template="ToastText01">
<text id="1">$(message)</text>
</binding>
</visual>
</toast>
{
aps: {
alert: “$(message)”
}
}
{ message: “Hello!” }
Hello!
Hello!
Enough talk…show me the code!
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!
Can't make it to San Francisco to attend Build this year? No worries, we've got you covered. Join us at the local
Microsoft office to watch the live stream of this year's keynote. We can't say much at this point, other than that the
content will be amazing.
We know it' during lunch, and we know how developers can get when they're not fed. Have no fears, food and
beverage will be provided. We'll also have a few giveaways including:
• Nokia Lumia 1020's
• Dell Venue 8 Pro Tablets
Register Now: http://aka.ms/build2014mn
Register Now: http://aka.ms/gwabcmn
When?
Saturday, March 29, 2014, 9:00 AM – 4:30
PM
Where?
SoMakers
Why?
Get bootstrapped into developing
application leveraging all Windows Azure
has to offer
adgroc@microsoft.com
@codel8r
thinkfirstcodelater.com
Contact Me
adam grocholski
//instantiate a new NotificationHub instance
NotificationHub hub = new NotificationHub("<hub name>", "<connection string>",
context);
//get the gcm id
GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(context);
String gcmid = gcm.register(SENDER_ID);
//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);
(void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *) deviceToken {
…
SBNotificationHub* hub = [[SBNotificationHub alloc] initWithConnectionString:
@"<connection string>" notificationHubPath:@“<hub>"];
[hub registerNativeWithDeviceToken:deviceToken tags:nil completion:^(NSError* error) {
if (error != nil) {
NSLog(@"Error registering for notifications: %@", error);
}
}];
}
var hubClient =
NotificationHubClient.CreateClientFromConnectionString("<connection string>",
“<hub name>");
var toastForIos = @“<notification payload>";
hubClient.SendAppleNativeNotificationAsync(toastForIos);
Delivery guarantee and telemetry
Notification Hubs do not provide delivery guarantee.
Telemetry.
Scale
Notification Hubs run on a fully parallelized architecture.
Number of devices and latency.
Platform support
Platform support.

Mobile March Windows Azure Notification Hubs