You must Sign In to post a response.
  • Category: ASP.Net MVC

    Task<NotificationOutcome> SendGcmNativeNotificationAsync(string jsonPayload); returning except

    public static void SendBroadcastNotification(string message)
    {
    NotificationHubClient hub = NotificationHubClient
    .CreateClientFromConnectionString(Constants.NotificationsHubConnectionString, "QiKStayNotificationHub");
    var stringify = message;
    var task = hub.SendGcmNativeNotificationAsync(stringify);
    try {
    task.Wait();
    }
    catch (AggregateException e)
    {
    foreach (Exception ex in e.InnerExceptions)
    {
    Console.WriteLine(ex.ToString());
    }

    }
    var notificationException = task.Exception;
    var notificationResult = task.Result;
    if(task.Exception == null)
    {

    }

    }


    This is returning 400 request ,how should I work on it to receive notification via azure sdk
  • #765242
    Hi,
    400 means BAD/Invalid request. Request must follow the rules understood by server.
    Please go through point no. 14 i.e. sendNotification() method from following URL:
    https://azure.microsoft.com/en-in/documentation/articles/notification-hubs-android-get-started/
    Or try this:
    //... call your method as follows:
    SendBroadcastNotification(message).Wait();
    //... Inside method, send request as
    var outcome = await hub.SendGcmNativeNotificationAsync("{ \"data\" : {\"msg\":\"Returned Message!\"}}");
    var state = task.State;
    var notificationResult = task.Result;
    Hope it helps.
    Regards,
    Shashikant Gurav
    shashikantgurav22@gmail.com


Sign In to post your comments