Azure Notification Hubs is a massively scalable mobile push notification engine for quickly sending millions of messages to iOS, Android, Windows, or Kindle devices. Tailor notifications to specific users-or entire audiences-with just a few lines of code, and do it across any platform
1. Azure
Notification Hub
Luca Di Fino
dev.luke2375@live.it
@luke2375
luke2375.wordpress.com
MICROSOFT MOBILE CAMP
ROMA, 12 Febbraio 2015
2. Agenda
• Overview
• Azure Notification Hub
• Let’s start
• Hub
• App
• Push
• Something more
• More notifications
• More channels
• More apps
• Q&A
MOBILE CAMP
ROMA, 12 Febbraio 2015
3. • Push Notifications offer developers a way
to send timely information relating to
their applications even when they are not
running
• Push notifications are delivered through
platform-specific infrastructures called
Platform Notification Systems (PNS)
+Windows has the unique ability to
provide the end user glanceable access
to the information they care most about,
via Live Tiles
MOBILE CAMP
ROMA, 12 Febbraio 2015
3
Back-end
PNS
Device
1
2
3
4
Retrieve PNS Handle
Store PNS Handle
Send Notification
Send to Device
4. • Users management
• Platform dependency
• Scale
• Refresh handles
• Multicast
• Routing
• Monitor and
telemetry
MOBILE CAMP
ROMA, 12 Febbraio 2015
4
10. 1. Create the notification hub – Azure
2. Get app SID and Secret – Dev Center (Windows or Windows Phone)
3. Configure hub
4. Create client app – Visual Studio
5. Create app backend
MOBILE CAMP
ROMA, 12 Febbraio 2015
19. MOBILE CAMP
ROMA, 12 Febbraio 2015
19
TileSquareImage/TileSquare150x150Image TileSquarePeekImageAndText02
20. • What if we want more granular control over notifications?
• If we want to push notifications only to people who are subscribed to
a specific category, we use tags.
App
Backend
Combine tags with AND (&&), OR (||), NOT (!) and parentheses.
Tag expressions are limited to 20 tags if they contain only ORs; otherwise they are limited to 6 tags
MOBILE CAMP
ROMA, 12 Febbraio 2015
20
string[] tagsToSubscribeTo = { "phone", "news" };
await hub.RegisterNativeAsync(channel.Uri, tagsToSubscribeTo);
await hub.SendWindowsNativeNotificationAsync(toast, "phone");
await hub.SendWindowsNativeNotificationAsync(toast, "phone && news");
await hub.SendWindowsNativeNotificationAsync(toast, "phone || news");
21. • When in Standard tier, Notification Hubs supports a feature that
enables you to schedule notifications up to 7 days in the future
• To cancel a scheduled notification
There are no limits on the number of scheduled notifications you can send
MOBILE CAMP
ROMA, 12 Febbraio 2015
21
Notification notification = new AppleNotification("{"aps":{"alert":"Happy birthday!"}}");
var scheduled = await hub.ScheduleNotificationAsync(notification, new DateTime(2014, 7, 19, 0, 0, 0));
await hub.CancelNotificationAsync(scheduled.ScheduledNotificationId);
Device token management
store and manage channel URIs and device tokens used by Platform Notification Services
securely handle the PNS feedback, device token expiry
Scale
broadcast to millions of devices with low latency
Backend
.NET, Node.JS, REST API, PHP, Java
Personalization
Each device can have one or more templates, to achieve per-device localization and personalization without affecting back-end code.