Follow

Azure Push Notification Hub- Push Notification service of Azure

0

Introduction to Azure Push Notification Hub

Push notifications deliver information from a back end system to a mobile application. Apple, Google, and other platforms each have their own Push Notification Service (PNS). Azure Notification Hubs enable you to centralize notifications across platforms so your back end application can communicate with a single hub, which takes care of distributing the notifications to each platform-specific PNS.

What is Azure Notification Hubs?

Azure Notification Hubs scaled-out push engine that enables you to send notifications to any platform (iOS, Android, Windows, etc.) from any back-end (cloud or on-premises). Here are a few example scenarios:

  • Send breaking news notifications to millions with low latency.
  • Send location-based coupons to interested user segments.
  • Send event-related notifications to users or groups for media/sports/finance/gaming applications.
  • Push promotional contents to applications to engage and market to customers.
  • Notify users of enterprise events such as new messages and work items.
  • Send codes for multi-factor authentication.

What is Push Notification?

Push notifications are a form of app-to-user communication where users of mobile apps are notified of certain desired information, usually in a pop-up or dialog box on a mobile device. It’s the best app-to-user communication because it is energy-efficient for mobile devices, flexible for the notifications senders, and available when corresponding applications are not active.

How does Push notifications work?

Push notifications are delivered through platform-specific infrastructures called Platform Notification Systems (PNSes). They offer basic push functionalities to deliver a message to a device with a provided handle, and have no common interface. To send a notification to all customers across the Android, iOS, and Windows versions of an app, the developer must work separately with Apple Push Notification Service (APNS), Fire base Cloud Messaging (FCM), and Windows Notification Service (WNS).

At a high level, here is how push works:

  1. An application wants to receive a notification, so it contacts the PNS for the target platform on which the app is running and requests a unique and temporary push handle. The handle type depends on the system (for example, WNS uses URIs while APNS uses tokens).
  2. The client app stores this handle in the app backend or provider.
  3. To send a push notification, the app backend contacts the PNS using the handle to target a specific client app.
  4. The PNS forwards the notification to the device specified by the handle.

 

Challenges of Push Notification

Sending push notifications requires complex infrastructure that is unrelated to the application's main business logic. Some of the infrastructure challenges are:

1.Platform dependency

  • The backend requires complex and hard-to-maintain platform-dependent logic to send notifications to devices on various platforms, as PNSes are not unified.

2.Scale

  • As per PNS guidelines, device tokens must be refreshed on every app launch. The backend deals with a large amount of traffic and database access just to keep the tokens up-to-date. When the number of devices grows to hundreds, thousands, or millions, the cost of creating and maintaining this infrastructure is massive.
  • Most PNSes do not support broadcast to multiple devices. A simple broadcast to a million devices results in a million calls to the PNSes. Scaling this amount of traffic with minimal latency is nontrivial.

3.Routing

  • Though PNSes provide a way to send messages to devices, most app notifications are targeted at users. The backend must maintain a registry to associate devices with users, etc.

Why use Azure Notification Hubs?

Notification Hubs eliminates all complexities associated with sending push notifications on your own from your app back end. With Notification Hubs, the back end sends messages to users or interest groups, as shown in the following figure:

Notification Hubs is your ready-to-use push engine with the following advantages:

1.Cross platforms

  • Support for all major push platforms.
  • A common interface to push to all platforms in platform-specific or platform-independent formats with no platform-specific work.
  • Device handle management in one place.

2.Cross backends

  • Cloud or on-premises.
  • .NET, Node.js, Java, Python, etc.

3.Rich set of delivery patterns

  • Push to segment with dynamic tags:The tags feature helps you segment devices and push to them according to your needs, whether you are sending to one segment or an expression of segments (For example, active AND lives in Seattle NOT new user). Instead of being restricted to publish-subscribe, you can update device tags anywhere and anytime.
  • Localized push:The templates feature helps achieve localization without affecting back end code.
  • Silent push:You can enable the push-to-pull pattern by sending silent notifications to devices and triggering them to complete certain pulls or actions.
  • Scheduled push:You can schedule notifications to be sent anytime.
  • Direct push:You can skip registering devices with the Notification Hubs service and directly batch push to a list of device handles.
  • Personalized push:Device push variables help you send device-specific personalized push notifications with customized key-value pairs.

4.Scalability

  • Send fast messages to millions of devices without re-architecting or device sharing.

5.Security

  • Shared Access Secret (SAS) or federated authentication.

Notification

A notification is a message that Android displays outside your app's UI to provide the user with reminders, communication from other people, or other timely information from your app.

Status Bar and Notification Drawer

When you issue a notification, it first appears as an icon in the status bar.

Users can swipe down on the status bar to open the notification drawer, where they can view more details and take actions with the notification.

Users can drag down on a notification in the drawer to reveal the expanded view, which shows additional content and action buttons, if provided.

A notification remains visible in the notification drawer until dismissed by the app or the user.

Head-up Notification

Beginning with Android 5.0, notifications can briefly appear in a floating window called a heads-up notification. It appears only if the device is unlocked.

The heads-up notification appears the moment your app issues the notification and it disappears after a moment, but remains visible in the notification drawer as usual.

How to send Push Notification to android devices using firebase?

This Article shows you how to use Azure Notification Hubs and Firebase Cloud Messaging (FCM) to push notifications to an Android application. You must create Android app that receives push notifications by using Firebase Cloud Messaging (FCM).

Android-Prerequisites

  • The latest version of Android Studio
  • Android 2.3 or higher for Fire base Cloud Messaging
  • Google Repository revision 27 or higher for Fire base Cloud Messaging
  • Google Play Services 9.0.2 or higher for Fire base Cloud Messaging

Setup Push Notification Services for Android

Step1: Define an Android package name.

Step2: Download google-services.json from the Firebase console.

Step3: Create an Azure Notification Hub instance and give it a name.

Step4: Copy the FCM Server Key and save it as the API Key under Google (GCM/FCM) in your Azure Notification Hub.

How to send Push Notification to iOS apps using Azure Notification Hubs?

In this Article, you use Azure Notification Hubs to send push notifications to an iOS application. You must create a blank iOS app that receives push notifications by using the Apple Push Notification service (APNs).

iOS-Prerequisites

  • An active Azure account.
  • Windows Azure Messaging Framework
  • Latest version of Xcode
  • An iOS version 10 (or later)-capable device
  • Apple Developer Program membership.

Steps to setup Push Notification Services for iOS

Step 1: Define an IOS bundle identifier.

Step 2: Create a Certificate Signing Request (CSR) file and use it to generate a push notification certificate.

Step 3: Upload the push notification certificate under Apple (APNS) in your Azure Notification Hub.

0 comments
Please sign in to leave a comment.Join the conversation