Search code examples
iosruby-on-rails-3push-notificationapple-push-notificationsnewsstand-kit

Can I push a Newsstand notification with apn_on_rails?


Is there any way using apn_on_rails to push Newsstand notification? i.e. Push this kind of payload:

{"aps": {"badge": 1,"content-available":"1"} }

At the moment I can see that I can push notification with badge, sound, and alerts.

I'm sure it wouldn't be hard to modify apn_on_rails itself if it turns out it doesn't do it yet. There are so many branches of apn_on_rails, I am using this one at the moment.


Solution

  • The APN::Notification class has a custom_properties property that you use to include any generic data in the push notification. Using your payload as an example, you would do something like this:

    apn = APN::Notification.new
    apn.badge = 1
    apn.custom_properties = {"content-available" => 1}