Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure 无法发送推送通知_Azure_Google Cloud Messaging - Fatal编程技术网

Azure 无法发送推送通知

Azure 无法发送推送通知,azure,google-cloud-messaging,Azure,Google Cloud Messaging,我正在尝试按照,发送推送通知: var hubClient = NotificationHubClient.CreateClientFromConnectionString("Endpoint=sb://xxx-ns.servicebus.windows.net/;SharedAccessKeyName=DefaultFullSharedAccessSignature;SharedAccessKey=xxx=", "xxxapp"); hubClient.Send

我正在尝试按照,发送推送通知:

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在Service Bus 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();
private静态异步任务CallNotificationHub()
{
var hubClient=NotificationHubClient.CreateClientFromConnectionString(
"",
"");
var结果=等待hubClient.SendGcmNativeNotificationAsync(
“{\'data\':{\'msg\':\'Hello from Windows Azure!\”}}”);
返回结果。状态;
}
CallNotificationHub().Wait();