How to show the notification count over app icon using xamarin forms in visual studio 2019.
Welcome to our Microsoft Q&A platform!
Xamarin.Forms is only an UI framework, this function needs to achieved on each platform. On iOS, please register for user notifications to be able to set the application icon badge number:
//Register this in the Appdelegate UIUserNotificationSettings settings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Badge, null); UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
Then use the
UIApplication.SharedApplication.ApplicationIconBadgeNumber = number; to set the badge number, you could DependencyService to call the function code in the shared project.
Unfortunately, the function is limited on Android. Android system doesn't allow changing of the application icon because it is sealed in the .apk tightly once the program is compiled. There is no way to change the icon to a 'drawable' programmatically.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
8 people are following this question.