8

I understand that it is possible to set the badge counter when publishing to individual devices, but is it possible to set a device independent counter when publishing to ALL devices subscribed to a certain topic ARN?

Current use case is there could be up to a million users subscribed to a certain topic and having to publish push notifications to each device ARN one by one (opposed to a topic ARN) seems really inefficient, from a server-side standpoint.

Frameworks Used

Backend: Python Flask framework with BOTO AWS SDK and SQLAlchemy

Frontend: iOS

1

1 Answer 1

6

Short answer

No, you can't.

Apple dont let you send "+1" as badge number, so sending the same badge number to all users that are subscribed to a specific topic should not help you.

Long answer

AWS SNS

AWS SNS let you make custom payloads per platform on the same topic, so it should not be a problem:

To send a message to an app installed on devices for multiple platforms, such as GCM and APNS, you must first subscribe the mobile endpoints to a topic in Amazon SNS and then publish the message to the topic. The following example shows a message to send to subscribed mobile endpoints on APNS, GCM, and ADM

http://docs.aws.amazon.com/sns/latest/dg/mobile-push-send-custommessage.html#mobile-push-send-multiplatform

{ 
"default": "This is the default message which must be present when publishing a message to a topic. The default message will only be used if a message is not present for 
one of the notification platforms.",     
"APNS": "{\"aps\":{\"alert\": \"Check out these awesome deals!\",\"url\":\"www.amazon.com\"} }",
"GCM":"{\"data\":{\"message\":\"Check out these awesome deals!\",\"url\":\"www.amazon.com\"}}",
"ADM": "{ \"data\": { \"message\": \"Check out these awesome deals!\",\"url\":\"www.amazon.com\" }}" 
}

Apple

Apple don't let you increment the badge number, so I guess sending the same badge number to all users would not be help you.

Key: Badge

Type: Number

Description: The number to display as the badge of the app icon. If this property is absent, the badge is not changed. To remove the badge, set the value of this property to 0.

https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html

3
  • 3
    Seems like a huge limitation on the SNS platform. Amazon already stores the all the device ARNs, all they need is to add an extra column for 'current badge number' and allow us to set that manually. Might end up switching to urban airship.
    – ken
    Commented Aug 23, 2015 at 7:34
  • In our case we are storing the "current badge number" inside our RDS server, but seems like a workaround. Also, as an alternative you can try Parse.com blog.parse.com/announcements/badge-management-for-ios Commented Aug 23, 2015 at 11:59
  • 2
    Just wanted to leave a link to the same answer from an Amazonian which states: "Currently SNS does not have this feature. You have to track the badge counter on the server side and publish to each endpoint individually, or keep track of the badge counter on the device.". Taken from forums.aws.amazon.com/thread.jspa?messageID=670000 Commented Jan 8, 2017 at 6:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.