Search code examples
androidasp.netazureazure-notificationhubazure-eventhub

How to receive messages from event hub and forward to android application using Azure Notification Hubs?


I want to receive messages from an event hub in .net and sending them to my android application (with notification hub).

At the moment, I receive the messages from the event hub using Event processor.

Now I want to forward them to my android application. What is the best way to complete this?


Solution

  • I'd recommend linking your Event Hub with Notification Hubs via an Azure Function.

    Step 1: Your Android device must register with the FCM to get a device token and then register the device with Notification Hubs. Since we are going to be dealing with Azure Functions, which is based on App Service, you can use App Service Push for this functionality - this will require a "HTTP POST" to the endpoint. See http://aka.ms/zumobook Chapter 5 for a Xamarin implementation of this.

    Step 2: Create an Azure Function to link the event hub, do whatever processing you need and submit a push notification to the Notification Hub. See https://learn.microsoft.com/en-us/azure/azure-functions/ for the documentation source on this.