Increment Push Notification Badges

Automatic Badge Count in Push Notification requires logic to be written on the client as well as the server side to maintain its count and messages clicked on. Well, if you ever plan of doing it alone, know that your time is going to go for a toss. Therefore, App42 Push Notification introduced this amazing service to make the developer’s life much easy. This comes up with a single flag that you have to pass in API call to notify App42 server about auto increment badge count. After this, you can just sit back and rest will be efficiently looked after by App42 server.

Here are the few use cases that can be achieved through auto incremental badge count in App42 Push Notification.

For auto increment of push badge by 1, you need to send push message as shown below.

1
2
3
4
PushNotificationService pushNotificationService = App42API.BuildPushNotificationService (); // Initializing PushNotification Service.
string userName = "UserName";
string message= "{'badge':'increment'}";
pushNotificationService.SendPushMessageToUser(userName,message, new UnityCallBack())

N.B: The sample explained is for Unity/C# but the same process can be applied on others too.

PushImage Increment Push Notification Badges

If you want to stipulate any number for the badge or want to reduce the badge count to zero, you can use this method to update the count as the notification gets clicked by the user. You have to call updatePushBadgeforDevice or updatePushBadgeforUser in this case.

1
2
3
4
5
PushNotificationService pushNotificationService = App42API.BuildPushNotificationService (); // Initializing PushNotification Service.
string userName = "UserName";
string deviceToken = "DeviceToken";
int badges = 10; // For clear count make it 0 
pushNotificationService.UpdatePushBadgeforDevice(userName, deviceToken, badges,  new UnityCallBack());
1
2
3
4
PushNotificationService pushNotificationService = App42API.BuildPushNotificationService (); // Initializing PushNotification Service.
string userName = "UserName";
int badges = 10; // For clear count make it 0
pushNotificationService.UpdatePushBadgeforUser(userName, badges,  new UnityCallBack());

updatePushBadgeforDevice – This method is used to update push badge count of a particular device registered by the user .
updatePushBadgeforUser – This method is used to update push badge count of all the devices that a user procures. In this case, we are assuming that the user has multiple devices registered under his name.

Here, we end on a learning note for you and truly hope that this feature proves out to be useful in managing badges for your fabulous apps.

If you have any queries or require further assistance, please feel free to reach us at support@shephertz.com

twitter Increment Push Notification Badgesfacebook Increment Push Notification Badgesgoogle Increment Push Notification Badgeslinkedin Increment Push Notification Badgespinterest Increment Push Notification Badgesreddit Increment Push Notification Badgesstumbleupon Increment Push Notification Badgestumblr Increment Push Notification Badges

Leave a Reply

Your email address will not be published. Required fields are marked *


+ 2 = eight

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>