如何在后台应用时显示Xamarin iOS中的徽章数量

时间:2018-04-24 15:25:12

标签: xamarin xamarin.forms xamarin.ios

任何人都可以在Xamarin iOS中向我提出任何关于在背景中应用时显示徽章计数的想法

实际上在背景中,当通知到来时,Xamarin iOS中没有任何方法触发器。

1 个答案:

答案 0 :(得分: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();
       ----------
       ------------

}