当在后台应用程序时如何在Xamarin iOS中显示徽章计数

问题描述 投票:0回答:1

有人在后台应用程序时,请给我任何有关Xamarin iOS中显示徽章计数的想法

实际上在后台,当收到通知时,Xamarin iOS中没有任何方法触发器。

xamarin xamarin.forms xamarin.ios
1个回答
0
投票
public class UserNotificationCenterDelegate : UNUserNotificationCenterDelegate
{
    #region Constructors
    public UserNotificationCenterDelegate()
    {
    }
    #endregion

    #region Override Methods
    public override void WillPresentNotification(UNUserNotificationCenter center, UNNotification notification, Action<UNNotificationPresentationOptions> completionHandler)
    {
           /// here we can add badge 

    }
}

*****************
public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions)
    {

      UNUserNotificationCenter.Current.Delegate = new UserNotificationCenterDelegate();
       ----------
       ------------

}
© www.soinside.com 2019 - 2024. All rights reserved.