0

Can anyone please give me any idea for show badge count in Xamarin iOS when application in background

Actually In background there are no any method trigger in Xamarin iOS when notification come.

  • You can't just request code from others, you need to show your progress and what you have attempted to implement that. – Patrick Apr 24 '18 at 17:23
  • Why? You are here to judge activity, if I talking about my question if you known ans then need to reply, stack overflow will not give position of CEO after gaining credit from this. – Shashikant Yadav Apr 24 '18 at 18:14
  • You can't control the badge number with code when application in background, but you can send the badge number in the payload of the push notification , refer to [this answer](https://stackoverflow.com/a/14256852/8187800). – ColeX Apr 25 '18 at 06:38
  • @ColeXia-MSFT agree but need any another idea rather then above? – Shashikant Yadav Apr 29 '18 at 07:27
  • @ShashikantYadav, Have you found any method is fired when app is in background and notification received in iOS? – Srusti Thakkar Jun 28 '18 at 07:29

1 Answers1

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();
       ----------
       ------------

}