Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Push Notification Increase Badge Count When Receive Notification

I am using iOS 10 with swift 2.3 I need to increase badge count when receiving new notification from firebase. I have code to increase badge count

let badgeCount: Int = BadgeCount + 1
UIApplication.sharedApplication().applicationIconBadgeNumber = badgeCount

But I don't know where to use it to make it work correctly.

like image 831
Kavin Kumar Arumugam Avatar asked Dec 23 '22 21:12

Kavin Kumar Arumugam


1 Answers

If you are using Firebase push notification we just need to enable iOS badge and include badge count before sending. In AppDelegate.Swift, in the applicationDidBecomeActive function we need to add

UIApplication.sharedApplication().applicationIconBadgeNumber = 0 
like image 82
Kavin Kumar Arumugam Avatar answered May 16 '23 07:05

Kavin Kumar Arumugam