ToolbarItemBadgeSample icon indicating copy to clipboard operation
ToolbarItemBadgeSample copied to clipboard

Badge count not working in navigation to another page

Open susantadotnet opened this issue 4 years ago • 1 comments

Hi, Clicked on button it got increment badge, click navigate button to navigate another page fine. but now when i back to home page again then the badge count cleared.

Please suggest your thought how to handle it.

Thanks

susantadotnet avatar Sep 03 '20 13:09 susantadotnet

ON android is bugged, you have to add a delay:

if (Device.RuntimePlatform == "Android")
                {
                    shoppingCartElementsNumber = await Services.ShoppingCartManager.GetCartItemsNumber();
                    if (shoppingCartElementsNumber > 0)
                    {
                        await Task.Delay(200); //specify the delay
                        DependencyService.Get<IToolbarItemBadgeService>().SetBadge(this, ToolbarItems.First(), shoppingCartElementsNumber.ToString(), Color.Red, Color.White);
                    }
                }

zank-stlab avatar Sep 18 '20 09:09 zank-stlab