使用Azure通知中心向半径内的Android设备发送通知

时间:2017-03-31 16:00:45

标签: azure azure-functions azure-notificationhub

我正在使用Azure Functions和Notification Hub构建原型。

在我的功能中,我希望根据地理空间查询选择一堆设备,并向这些结果设备发送通知。

我有使用Firebase和Android的通知,但如何根据查询结果定位一组随机设备?

#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));
}

1 个答案:

答案 0 :(得分:2)

您的解决方案将取决于您要实现的目标。您没有详细说明您要定位的方案类型。

但总的来说,在不知道具体要求的情况下,您可能会发现以下示例很有用:

您还可以从通知中心了解Routing and tag expressions中获益。