Arti
Arti

Reputation: 7762

Remove notification badge icon with specific type

In my app i want to send for users 2 types of notification.

  1. From stuff(admin send it manually)

  2. When statistic will update.

I want to remove badge with stuff notifications when user launch application, and statistic notification badge when user enter in some screen after login. But i only found method:

application.applicationIconBadgeNumber = 0

So how it is possible to detect, what i need to remove...

Upvotes: 0

Views: 499

Answers (1)

Shahab Qureshi
Shahab Qureshi

Reputation: 950

In some case we don't want to set badge icon to ZERO at all. There is method to get app-icon badge numbers.

[UIApplication sharedApplication].applicationIconBadgeNumber = [UIApplication sharedApplication].applicationIconBadgeNumber - 1;

Once you receive push-alert, you will have some KEY whether its STUFF or STATIC update.

Once user click on push notification from notification tray or on alert. Check for that KEY(Stuff/Static) & using above line change badge number reduce badge number.

I hope this will give you idea.

Upvotes: 1

Related Questions