1
votes

I'm using a paid Pushwoosh Account in order to send programmatically push-notifications to my users.

I've implemented the Pushwoosh PHP SDK and everything works great, but I'm not able to set a Notification-Badge on iOS devices as seen on the following image:

enter image description here

My code so far is:

$devicesArr[] = ...

$pushwoosh = Pushwoosh::create()
                        ->setApplication('79XXX-9CXXX')
                        ->setAuth('Wkf...2C8');

//Create the Message
$request = CreateMessageRequest::create()
                        ->addNotification(Notification::create()
                        ->setContent('A new workout is available!')
                        ->setDevices($devicesArr));

//Call the REST Web Service
$response = $pushwoosh->createMessage($request);

I tried to use the ->setBadge(5) method according to this page but this also does not work:

$request = SetBadgeRequest::create()
    ->setBadge(1)
    ->setHwid('18D...1AF');

Do you know how I can achieve my goal?

2
Did your app received notification? when you registered notification, did you set UIRemoteNotificationTypeBadge for UIUserNotificationSettings? - Luan Nguyen
Thank you for your response. I'm using Ionic/Cordova and the Pushwoosh-Cordova-Plugin in order to use Pushwoosh. Yes, everything works fine as I'm retrieving the push-notifications (both on iOS and Android). But I'm not able to set a badge count. - John Brunner

2 Answers

0
votes

I can't reproduce this on Cordova Sample (https://github.com/Pushwoosh/pushwoosh-phonegap-cordova-sample/tree/master/Phonegap-iOS-Android-WP), can you share a simple sample?

Are you sure the app is closed when you receive push with badge?

0
votes

Per the docs, this is not the method you use to set the badge number on the device.

Important

This method IS NOT used to update the badge value on the device. Instead please use /createMessage request with the "ios_badges" parameter. http://docs.pushwoosh.com/docs/setbadge