簡體   English   中英

使用Azure通知中心向半徑內的Android設備發送通知

[英]Send notification to android devices within a radius using Azure Notification Hub

我正在使用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));
}

您的解決方案將取決於您要實現的目標。 您沒有詳細說明您要定位的方案類型。

但總的來說,在不知道具體要求的情況下,您可能會發現以下示例很有用:

您還可以從Notification Hubs中了解路由和標記表達式中獲益。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM