2. ABOUT ME
• Ivan Marković
• Span d.o.o.
• Software Developer
• Student at Faculty of Electrical Engineering Osijek
• Microsoft Student Partner Lead at Osijek
4. • Push notifications are simple messages from apps
installed on a device that wake up the handset and alert
the user with a message displayed on the home or lock
screen.
• Push notifications are widely used on all mobile devices
as a way to inform or update the user. They are generally
accepted as a great way to bring app users back to your
app.
WHAT ARE PUSH NOTIFICATIONS?
5. By end-2014 there was 1.75 billion smartphone users and a
total of 4.55 billion mobile users worldwide
4.55 BN 1.75 BN
mobile users smartphone users
MOBILE PUSH IS EVERYWHERE
6. Smartphone owners spend 2 hours 42 min per day on their mobile
Preferred activity of smartphone users?
Apps usage
80%
Mobile browsers
20%
7. The most popular types of push notifications are:
Social
65%
Weather
60%
Games
48%
News
46%
8. HOW MANY PEOPLE HAVE PUSH MESSAGES
ENABLED IN THEIR APPS?
iOS 46% Android 59%
9. OPEN RATES AND CONVERSION RATES
• 3% of broadcast push
messages are opened
• Only 15% of users who
clicked on a broadcast
push message converted
• 7% if the push message is
segmented by user
behaviour and preferences
• 54% of users who clicked
on a segmented push
message converted
10. • Because users with push enabled have:
WHY INCORPORATE PUSH MESSAGING IN
YOUR APP?
3x HIGHER
retention
88% MORE
app launches
55% SHORTER INTERVAL
between app sessions
14% MORE
power users (10+ sessions/month)
11. PUSH NOTIFICATION LIFECYCLE
Platform
Notification
Service
App back-end
Registration at app launch
1. Client app contacts Platform Notification Service,
to retrieve current channel (e.g. ChannelURIs,
device tokens, registrationIds)
2. App updates handle in back-end
Sending Notification
1. App back-end send notification to PNS
2. PNS pushes the notification to the app on the
device
Maintenance
1. Delete expired handles when PNS rejects them
12. • Platform dependency
Different communication protocols to PNS (e.g. xml
payload vs json payload)
Different presentation formats
CHALLENGES OF PUSH NOTIFICATIONS
13. • Scale
Per PNS guidelines, device tokens must be refreshed every time the app
is launched. When the number of devices grows the cost of creating
and maintaining this infrastructure is nontrivial.
• Most PNSs do not support broadcasting to multiple devices. As such, a
broadcast to millions of devices results in millions of calls to the PNSs.
14. • Routing
In most apps, notifications are targeted at users and/or interest groups
(for example, all employees assigned to a certain customer account). As
such, the app backend must maintain a registry that associates interest
groups with device tokens in order to route the notifications to the
correct devices.
This overhead adds to the total time to market and maintenance costs
of an application.
15. • Monitoring and Telemetry
In most apps, notifications are targeted at users and/or interest groups
(for example, all employees assigned to a certain customer account). As
such, the app backend must maintain a registry that associates interest
groups with device tokens in order to route the notifications to the
correct devices.
This overhead adds to the total time to market and maintenance costs
of an application.
17. USING NOTIFICATION HUBS
Notification Hub
Platform
Notification
Service
App
back-end
One-time set up
1. Create a Notification Hub
Register
1. The client app retrieves its current handle from
the PNS
2. Client app creates (or updates) a registration
on the Notification Hub with the current
handle
Send Notification
1. The app back-end sends a message to the
Notification Hub
2. Notification Hub pushes it to the PNS’
18. • Multiple platforms:
o Support for all major mobile platforms (Windows/Windows Phone,
iOS, Android).
o No platform-specific protocols. The application only communicates
with Notification Hubs.
o Device handle management. Notification Hubs maintains the handle
registry and feedback from PNSs.
• Works with any back-end. Cloud or on-premises, .NET, PHP,
Java, Node, etc.
ADVANTAGES OF USING NOTIFICATION HUBS
19. • Scale. Notification Hubs scale to millions of devices without the need of
re-architecting or sharding. Available in all regions.
• Personalization. Each device can have one or more templates, to
achieve per-device localization and personalization without affecting
back-end code.
• Rich telemetry. Available in the portal and programmatically.
• Rich set of delivery patterns. Associate devices with tags, representing
logical users or interest groups.
o Broadcast
o Unicast/Multicast
o Segmentation
22. • The only way to target specific registrations is to
associate them with a tag, then target that tag.
• The application backend can choose the registrations to
target with a specific notification in the following ways:
1. Broadcast: all registrations in the notification hub receive the
notification.
2. Tag: all registrations that contain the specified tag receive the
notification.
3. Tag expression: all registrations whose set of tags match the
specified expression receive the notification.
TARGETING SPECIFIC REGISTRATIONS
23. • A tag can be any string, up to 120 characters.
TAGS
Notification Hub
App back-end
Register for tag „Sport”
Register for tag „Technology”
Notification sent to tag
„Technology”
24. Notification Hub
App back-end
Register for tag „Sport”
Register for tag „Technology”
Notifications sent to tags
„Technology” and „follows_John”
Register for tags „Technology”
and „follows_John”
25. • Using tags to target users
Notification Hub
App back-end
Register for tag „ user_John”
Notifications sent to tags
„user_John” Register for tag „user_John”
John
Bob
Register for tag „user_Bob”
27. REGISTRATION MANAGEMENT FROM THE
DEVICE
Notification Hub
App
back-end
Platform
Notification
Service
• When managing registrations
from client apps, the backend is
only responsible for sending
notifications.
• Client apps keep the PNS handles
up to date, and register to tags.
The following picture illustrates
this pattern.
28. • Client app can only update its tags when the app is
active.
• Since apps can be hacked, securing the registration to
specific tags requires extra care.
DRAWBACKS OF REGISTERING FROM THE
DEVICE
29. REGISTRATION MANAGEMENT FROM THE
APP BACK-END
Notification Hub
App
back-end
Platform
Notification
Service
• Managing registrations from the
backend requires writing
additional code.
• The app from the device must
provide the updated PNS handle
to the backend every time the
app starts (along with tags and
templates), and the backend must
update this handle on Service
Bus.
30. • Ability to modify tags to registrations even when the
corresponding app on the device is inactive.
• Authenticate the client app before adding a tag to its
registration.
ADVANTAGES OF MANAGING REGISTRATIONS
FROM THE BACKEND
33. • Templates enable a client application to specify the exact
format of the notifications it wants to receive. Using
templates, an app can realize several different benefits,
including the following :
o A platform-agnostic backend.
o Personalized notifications.
o Client-version independence.
o Easy localization.
WHY TEMPLATES?
34. • The standard way to send push notifications is to send,
for each notification that is to be sent, a specific payload
to platform notification services (WNS, APNS).
USING TEMPLATES CROSS-PLATFORM
{“aps”: {“alert” : “Hello!” }}
<toast>
<visual>
<binding template="ToastText01">
<text id="1">Hello!</text>
</binding>
</visual>
</toast>
35. • The Notification Hubs template feature enables a client app to create
special registrations, called template registrations, which include, in
addition to the set of tags, a template.
Notification Hub
App back-end
{“aps”: {“alert” : “$(message” }}
{“message”: „Hello!”}
Hello!
Hello!
<toast>
<visual>
<binding template="ToastText01">
<text id="1">$(message)</text>
</binding>
</visual>
</toast>
36. • Another advantage to using templates is the ability to
use Notification Hubs to perform per-registration
personalization of notifications.
USING TEMPLATES FOR PERSONALIZATION
<tile>
<visual>
<binding template="TileWideSmallImageAndText04">
<image id="1" src="$(day1_image)" alt="alt text"/>
<text id="1">Seattle, WA</text>
<text id="2">$(day1_tempC)</text>
</binding>
</visual>
</tile>
Prikaz kreiranje notification hubu na Azureu, što je sve potrebno postaviti, podesiti itd., primjer jednostavne neke aplikacije pomoću koje se šalje notifikacija nešto nešto
This requirement forces the app backend to produce different payloads for each platform, and effectively makes the backend responsible for part of the presentation layer of the app. Some concerns include localization and graphical layouts (especially for Windows Store apps that include notifications for various types of tiles).
For example, consider a weather app that displays a tile with the weather conditions at a specific location. A user can choose between Celsius or Fahrenheit degrees, and a single or five-day forecast. Using templates, each client app installation can register for the format required (1-day Celsius, 1-day Fahrenheit, 5-days Celsius, 5-days Fahrenheit), and have the backend send a single message that contains all the information required to fill those templates (for example, a five-day forecast with Celsius and Fahrenheit degrees).