0

I am using firebase notification it's working fine, when application in foreground I want display the remote notification count in App, 1 :when I can get message notification I have to show the remoter notification count.

from my payload badge count always sending 1 only,

image here

how can I show notification count?

halfer
  • 19,824
  • 17
  • 99
  • 186
Dhruv
  • 13
  • 1
  • 7
  • you have to set badges in your push notification payload.Look at thsese links https://stackoverflow.com/questions/14256643/update-badge-with-push-notification-while-app-in-background https://stackoverflow.com/questions/37372548/how-to-handle-app-icon-badge-count-on-receiving-push-notification – Gagan_iOS Aug 29 '17 at 10:01
  • @Gagan_iOS is there any possible to increment count of the notification in app – Dhruv Aug 29 '17 at 10:03
  • You have to use a badges. also you can get badge count from push notification pay-load. – Shah Nilay Aug 29 '17 at 10:03
  • @NilayShah when application in foreground I'm getting the notification how to show that count in my app, badge number I m getting how to diplay that number in my app when application in foreground – Dhruv Aug 29 '17 at 10:14
  • @Dhruv first get badge count either your app is foreground or background. set badge count in your global variable. now in the same `UIViewController` set this count to your badge control. – Shah Nilay Aug 29 '17 at 10:19
  • @NilayShah in background badge count when user tap the banner, how can in foreground when the application using how can I get count – Dhruv Aug 29 '17 at 10:25

2 Answers2

0

For push notification you have to write the logic on server. When server send the notification to the particular device it also send badge count with payload. IOS OS automatically update your app icon with badge count.

Zeeshan Arif
  • 509
  • 5
  • 15
0

Do below steps:

  1. Get final badge count from push notification payload.
  2. Save this count to your project global variable. (From any where you have to access it.)
  3. When you want to display a badge count at the same place give this variable value to badge.

For getting badge count from payload, please visit this link.

halfer
  • 19,824
  • 17
  • 99
  • 186
Shah Nilay
  • 778
  • 3
  • 21