0

AndroidおよびiOSデバイスにPUSHを送信する通知ハブがAzureにあります。 Androidではすべてがうまくいきます。 WhatsAppからそのデバイスにもメッセージを、私は無線LANの電源を切るか、私は Azure通知ハブからデバイスまたはインターネットを起動した後、iOSが保留中のプッシュを受信して​​いません

  • が、私は私のアプリにチャットメッセージを送信する機器の電源をオフ(プッシュ通知)と

    1. :iOS版では、私はこの問題を抱えています。
    2. 私は数分

    後、私はすべてのWhatsAppメッセージの通知なく、私のアプリへの通知の誰を受けるのWiFiをオンにするか、デバイスの電源をオンにします。デバイスとインターネットがオンになっている場合は、問題なく通知が届きます。

    私の質問は:誰かがそれを感じるか、それを修正する方法を知っていますか? 少なくとも私は最後のプッシュを受け取る必要がありますよね?

    タグにプッシュを送信しています。 WiFiまたはiPhoneがオフのときに、ハブに登録されているデバイスが表示されます。

  • 答えて

    0

    通知を送信する場合は、有効期限を設定してください。デフォルト値は0です。したがって、APNは通知をすぐに期限切れとみなし、通知を保管したり再配信を試みたりしないように扱います。

    https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html

    のAPN-満了
    この値がゼロでない場合、APNを通知 を記憶し、配信することができない場合 を必要に応じて試行を繰り返し、少なくとも一度、それを実現しようとし最初の通知。 の値が0の場合、APNは通知をただちに有効期限が切れるかのように扱い、 と通知を保管したり再配信を試みたりしません。

    テンプレート通知を使用している場合は、次のようにします。センドの一環として

    AppleTemplateRegistrationDescription registration = new AppleTemplateRegistrationDescription(parameters.registrationID) 
    { BodyTemplate = new CDataMember("{\"aps\":{\"alert\":\"$(body)\",\"payload\":\"$(payload)\",\"deeplinking\":\"$(deeplinking)\",\"category\":\"$(category)\",\"image\":\"$(image)\"}}"), 
               Tags = itags, 
    Expiry = "$(APNS_Expiry)" 
    }; 
    

    、あなたは時間切れ値を渡すことができます。

    var notification = new TemplateNotification(new Dictionary<string, string>() 
    { 
    {"APNS_Expiry", DateTime.UtcNow.AddMinutes(10).ToString("o") }, //Timestamp 
             {"body", NotificationText}, 
             {"payload", NotificationText}, 
             {"deeplinking", payload}, 
            }); 
          var Responsehub = hub.SendNotificationAsync(notification); 
    

    テンプレートの通知を使用している場合は、

    // Native notification 
        var notification = new AppleNotification(@" 
        { 
         ""aps"": { 
         ""alert"":""New notification!"" 
         } 
        }"); 
    
        notification.Expiry = DateTime.UtcNow.AddMinutes(2); 
    
    await notificationHubClient.SendNotificationAsync(notification); 
    
    +0

    はい!それが問題です。どうもありがとう。私はAzureドキュメントを改善すべきだと思う...なぜ彼らはスタートガイドのドキュメントにそれを含めていないのですか?もちろん、プッシュしておきたい場合はもう一度やり直したいと思っています。誰がそれを望んでいないのですか? – Ivan

    0

    をネイティブの通知を使用している場合は、ここにあなたがそれを行う方法です。

    AppleTemplateRegistrationDescription registration = new AppleTemplateRegistrationDescription(parameters.registrationID) 
    { BodyTemplate = new CDataMember("{\"aps\":{\"alert\":\"$(body)\",\"payload\":\"$(payload)\",\"deeplinking\":\"$(deeplinking)\",\"category\":\"$(category)\",\"image\":\"$(image)\"}}"), 
               Tags = itags, 
    Expiry = "$(APNS_Expiry)" 
    }; 
    

    送信の一部として、有効期限の値を渡すことができます。

    var notification = new TemplateNotification(new Dictionary<string, string>() 
    { 
    {"APNS_Expiry", DateTime.UtcNow.AddMinutes(10).ToString("o") }, //Timestamp 
             {"body", NotificationText}, 
             {"payload", NotificationText}, 
             {"deeplinking", payload}, 
            }); 
          var Responsehub = hub.SendNotificationAsync(notification); 
    

    あなたはネイティブの通知を使用している場合は、

    // Native notification 
        var notification = new AppleNotification(@" 
        { 
         ""aps"": { 
         ""alert"":""New notification!"" 
         } 
        }"); 
    
        notification.Expiry = DateTime.UtcNow.AddMinutes(2); 
    
    await notificationHubClient.SendNotificationAsync(notification); 
    
    関連する問題