gpt4 book ai didi

azure - 无法发送推送通知

转载 作者:行者123 更新时间:2023-12-02 07:14:52 27 4
gpt4 key购买 nike

我正在尝试遵循tutorial ,发送推送通知:

var hubClient = NotificationHubClient.CreateClientFromConnectionString("Endpoint=sb://xxx-ns.servicebus.windows.net/;SharedAccessKeyName=DefaultFullSharedAccessSignature;SharedAccessKey=xxx=", "xxxapp");
hubClient.SendGcmNativeNotificationAsync("{ \"data\" : {\"msg\":\"Hello from Windows Azure!\"}}", "xxxapp");
}

但是我没有得到任何回应?不再支持 SendGcmNativeNotification。

最佳答案

SendGcmNativeNotification 在服务总线 SDK 2.1 中被标记为内部。至于您的问题,SendGcmNativeNotificationAsync() 不返回实际结果,它返回一个任务。以下是如何使用 c# 5 语法使用它的示例:

private static async Task<NotificationOutcomeState> CallNotificationHub()
{
var hubClient = NotificationHubClient.CreateClientFromConnectionString(
"<your connection string with full access>",
"<your notification hub name>");
var outcome = await hubClient.SendGcmNativeNotificationAsync(
"{ \"data\" : {\"msg\":\"Hello from Windows Azure!\"}}");
return outcome.State;
}

CallNotificationHub().Wait();

关于azure - 无法发送推送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18051457/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com