Send notification to Android devices in radius using Azure Notification Hub

I am prototyping using Azure Functions and Notification Hub.

As part of my function, I want to select a set of devices based on a geospatial query and send a notification to these listed devices.

I have notifications working with Firebase and Android, but how do I set up a target device group based on the query result?

#r "Microsoft.Azure.NotificationHubs"
#load "location.csx"


using System;
using System.Net;
using Microsoft.Azure.NotificationHubs;


public static async Task Run(LocationInfo message, IAsyncCollector<Notification> notification, TraceWriter log)
{
    log.Info($"Sending GCM notification of a new user");
    string gcmNotificationPayload = "{\"data\": {\"message\": \"test message")\" }}";
    log.Info($"{gcmNotificationPayload}");
    await notification.AddAsync(new GcmNotification(gcmNotificationPayload));
}

      

+3


source to share


1 answer


Your decision will depend on what you are trying to achieve. You have not provided details on what scenarios you are planning.

But in general, without knowing what exactly you are looking for, you can find the following examples:



You can also benefit from exploring Routing and Tag Expression in Notification Hubs.

+2


source