2

チュートリアルに従って、プッシュ通知を送信しようとしています:

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 はサポートされなくなりました。

4

1 に答える 1

1

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();
于 2013-08-06T02:20:47.830 に答える