How to show unread message count in listview?

SreeeeSreeee INMember ✭✭✭✭✭

I am developing a chat application like Facebook. In home page I am listing all the chat list, When opening a chat I am calling a REST API for getting new messages. Also, I implemented the push notification in my app. The push notification will receive when a new message comes.

The new messages listing REST API is called only when opening a chat. So how can I show the number of unread messages in a chat? Please suggest a suitable solution to show the unread message count? Is this feature possible using push notification?

Answers

  • LucasZhangLucasZhang Member, Xamarin Team Xamurai

    You can set the Badge of the tabbed icon just like in iOS . Badge is not available in forms.You can use the nuget package https://github.com/B1naryStudio/Xamarin.Badge .When received a new message ,call the method

    CrossBadge.Current.SetBadge(number);
    
  • SreeeeSreeee INMember ✭✭✭✭✭
    edited May 14

    @LucasZhang I didn't get your answer, can you please explain little more.

  • LucasZhangLucasZhang Member, Xamarin Team Xamurai

    Set the tabbed icon in the content page which contains chat listview.

  • SreeeeSreeee INMember ✭✭✭✭✭

    @LucasZhang I am listing groups in the home page, I need to show the message count on this page. Only after opening a chat I am calling the rest API for listing new messages. From the home page, there is no way to get new message details.

    I have implemented push notifications in my project. But push notifications OnMessageReceived() will execute only when the app is in the foreground state. When the app is in the background or killed state OnMessageReceived() will not execute. So how can I use the Xamarin.badge for this feature?

  • LucasZhangLucasZhang Member, Xamarin Team Xamurai

    You can set the badge on the icon Group

Sign In or Register to comment.