Forum Cross Platform with Xamarin

Batch count on app icon in cross platform Xamarin application

I am using firebase push notifications and would like to show the number of unread notifications on the application icon in android and iOS.
How can I do this in the shared project in a Xamarin cross platform application?

Best Answers


  • LandLuLandLu Member, Xamarin Team Xamurai

    It's simple for iOS. You only need to add a badge property in the payload to display the badge on the icon:
    Android's payload is different but you could also add a custom property in it. Then read it when the notification comes.
    At last, you could display it using some plugins. i.e. Xamarin.Badge:

  • devxusdevxus Member ✭✭

    Thanks for your reply ... yes after posting this question I saw the articles on the plugins and I am in favour of the plugins.

    But now I am stuck at the below.

    I recieve a notification payload with title body etc and onmessagerecieved is not fired when the app is in background unless I send a data payload .
    So I want to display on the app icon the count of the notifications recieved and not opened by the user....... (number of notifications in the notification tray).
    How can I achieve this since this calculation count of unread FCM notification is on the device notification tray and cannot be calculated on the server side.

  • devxusdevxus Member ✭✭

    I am new to xamarin....That information was realy helpful thanks.

    I am trying to use Xam.Plugin.Badge in standard xamarin cross platform project.
    But I am not able to use it.WHen I install I get a yellow triangle next to thepackage in references without any information.

    Cant we use this plaugin with .net standard projects? does it need PCL?

  • devxusdevxus Member ✭✭

    Thank you so much for the help!

Sign In or Register to comment.