簡體   English   中英

PushNotificationReceived事件不會觸發

[英]PushNotificationReceived event doesn't fire

我正在開發Windows Phone 8.1應用程序,但存在此問題。 我不希望在應用程序處於前台時彈出推送通知-因此,當從PushNotificationChannel接收到通知時,我正在檢查應用程序在PushNotificationReceived事件中是否位於前台,如果是這樣,我將通過以下方式取消通知:args。

void channel_PushNotificationReceived(PushNotificationChannel sender, PushNotificationReceivedEventArgs args)
{
    if(appInForeground)
    {
        args.Cancel = true;
    }
}

我的PushNotification后台任務( IBackgroundTask )觸發器是PushNotificationTrigger

問題 :有時當應用程序處於前台狀態時-我收到推送通知。 當我查看日志時,可以看到沒有觸發PushNotificationReceived事件。 我一生都沒有取消訂閱該活動...

可能事件沒有觸發但我的backgroundTask觸發器觸發了嗎?

這里有些可疑...

任何幫助將不勝感激。

Windows的推送通知系統中有一個選項可以在應用程序處於前台時禁止彈出窗口。 因此,基本上,在將推送發送到設備時,用於推送通知的xml應該具有此屬性。

從Windows Phone 8.1開始,電話還可以通過使用通知的XML內容中的ToastNotification.suppressPopup或ScheduledToastNotification.suppressPopup屬性來阻止顯示Toast通知。

在此鏈接中可以找到更多詳細信息。 希望這可以幫助!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM