This is a migrated thread and some comments may be shown as answers.

Increment push notification badge number

1 Answer 350 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nader
Top achievements
Rank 1
Nader asked on 11 Dec 2014, 05:30 PM
Hi,

I am working on an app that is using the "Telerik Verified" push plugin in AppBuilder. I am able to receive notifications from my server and the app's badge number is set to the value that is received in the payload. The thing is that the badge number never seems to increment automatically when new notifications are received.
I have looked around for solutions and have even tried setting the badge number to "+1" in the payload, but iOS seems to ignore this value if its being sent as a string. I even tried using the "setApplicationIconBadgeNumber" function but it is not being called while the app is not running.
The only way I found was to save every device's badge count on the server, which is incremented on the server side, and clear that value every time the app is launched, but I would rather be able to solve this problem on the client side.
Is there any way I could fix this issue without having to sync each device's notification state with the server?

Regards

1 Answer, 1 is accepted

Sort by
0
Anton Dobrev
Telerik team
answered on 16 Dec 2014, 02:14 PM
Hello Nader,

Thank you for posting to the Telerik Developer Forums.

Currently, the badge value is set to the value received in the badge key of the payload. The setApplicationBadgeNumber method in the plugin can be used only when the app is running (for example, to update the badge value).

With the next release of Telerik Backend Services, expected till the end of the week, you will be able to increment/decrement the current value of the badge with the payload sent from the server. For example, by specifying +1 for the badge, the current value will be incremented with one. Note that the current state is saved in a dedicated field of the device registration on the server.

To take full benefit from this functionality provided by the server, developers can update the stored badge value for their device from the client app or from a admin app. Whenever the user "responds" to a notification, the app should decrement the badge value on the server by 1 or reset the value of the badge when the app is launched. This solution is up to the developer and should be done programmatically from the client app.

Please, let me know if you have questions.

Regards,
Anton Dobrev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
Nader
Top achievements
Rank 1
Answers by
Anton Dobrev
Telerik team
Share this question
or