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

Telerik push notification badge issue

7 Answers 161 Views
Report a bug
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 21 Dec 2014, 02:02 PM
Hi,

I am using the telerik verified push notification plugin in my AppBuilder project and have noticed that the badge parameter no longer works.
It was working in the original phonegap plugin that is included in AppBuilder, and the badge would be set properly with the value that I sent from the server. Does using this plugin requires me to change my code, whether its client or server side, or is it a bug in the plugin?

Regards

7 Answers, 1 is accepted

Sort by
0
Anton Dobrev
Telerik team
answered on 22 Dec 2014, 01:32 PM
Hi Nader,

Thank you for posting to the Telerik Developer Forums.

We are sorry to hear that you are experiencing such issues. Could you please elaborate a little bit more on the issue you are experiencing and which functionality was working before and does not work now?

Please note that the Telerik Push Notifications plugin does not introduce any breaking changes to the badge handling in iOS.

If you are using the push notifications service from Telerik Backend Services - note that the server-side now supports automatically incrementing the badge number for push notifications of type "Broadcast". The badge value for each device is now saved on the server and with each new notification for a device, the badge count is incremented with 1. If this is the case, you need to update the device registration when the app is started and reset/decrement the stored value for the badge on the server.

I look forward to your reply.

Regards,
Anton Dobrev
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
0
Nader
Top achievements
Rank 1
answered on 22 Dec 2014, 01:51 PM
Hi Anton,

I have implemented my own server to handle push notifications where I keep track of the badge number for each device. The problem is that whenever I send a push notification, which includes the correct badge number, the iOS devices fail to update the badge number on the app's icon.

The weird thing is that I had no issues regarding the badge number when I used the Push Plugin that comes with AppBuilder, and since I switched to the Telerik Verified Plugin, I have not made any changes to my push notification server to introduce this issue. If I switch back to the original plugin (Push Plugin), everything works just fine.

Please note that the badge was updated successfully,using the Push Plugin, even when the app was in the background state or killed.

Here is a sample push notification payload that I create using php:
$body['aps'] = array(
    'alert' => 'Test Message',
    'badge' => 1,
    'sound' => 'default'
);

Looking forward to hearing from you soon.

Regards
0
Anton Dobrev
Telerik team
answered on 23 Dec 2014, 02:09 PM
Hi Nader,

Thank you for specifying this. I double-checked the code of the Telerik Push Notifications plugin and compared it with the initial Push Plugin used in AppBuilder here. I searched for logic that can modify the expected behavior but to no avail. Also, I wasn't able to reproduce the behavior on an actual device using the plugins - always the badge is set with the value sent in the payload.

Please note that the application badge is set on OS level with the value of the "badge" key in the notification payload sent from the server. Based on the provided code snippet I can conclude that you are sending to Apple a badge with value 1. Thus the badge on the app icon will be set to 1 as well. You need to update the badge number by sending a request with the saved state of the badge count that you have on the server. For example:
$body['aps'] = array(
    'alert' => 'Test Message',
    'badge' => 2,
    'sound' => 'default'
);

The client app (e.g. the plugin) cannot influence the badge number when the app is in the background - the value on the badge is set to the value of the 'badge' key.

When the app is running you can use the setApplicationBadgeNumber method in the plugin in order to update the badge icon on the app. The change will be shown when the app is exited/put in background. Otherwise the plugin will reset the badge count when the app is opened.

Please, let me know if you have further questions.

Regards,
Anton Dobrev
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
0
Nader
Top achievements
Rank 1
answered on 23 Dec 2014, 05:08 PM
Hi Anton,

Thank you for replying.

Please note that the code snippet I provided is only a sample, as I increment the badge on the server before actually sending out the notification. My problem is that event when sending a badge with value 1, the iOS devices fail to set the icon with this value.
I can see the notification in the notification center and I am able to get the notification sound, but the icon badge always stays empty.

Please advise.

Regards
0
Anton Dobrev
Telerik team
answered on 24 Dec 2014, 03:54 PM
Hi Nader,

This behavior occurs when the Badge App Icon option is disabled in the Notification Center for this app. Other reason might be that the device is not subscribing for the "badge" type when the notifications are initialized on the device from the pushNotification.register() method.

Could you please check the above suggestions on your side?

Regards,
Anton Dobrev
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
0
Nader
Top achievements
Rank 1
answered on 27 Dec 2014, 03:25 PM
Hi Anton,

I checked that the Badge App Icon option enable for this app, but how can I make sure that the app did subscribe for the "badge" type. I am setting the badge parameter to true when initializing the push notifications in my app, but is there any way to verify that it has successfully registered with Apple?

Regards
0
Anton Dobrev
Telerik team
answered on 31 Dec 2014, 03:36 PM
Hi Nader,

Whatever options (badge, sound, alert) you choose when enabling the notifications for the app will be applied to the registration. However, these settings could be overridden by the user in the notification center. If you receive a token - the device is successfully registered with Apple, but this only means that the device can receive push notifications from the server. It does not mean that the user has enabled/disabled some of the options of the notification.

Let me know if you have questions.

Regards,
Anton Dobrev
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
Tags
Report a bug
Asked by
Nader
Top achievements
Rank 1
Answers by
Anton Dobrev
Telerik team
Nader
Top achievements
Rank 1
Share this question
or