Frage

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.

War es hilfreich?

Lösung

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}

Andere Tipps

Grocer also supports Newsstand notifications. https://github.com/grocer/grocer#newsstand-notifications

notification = Grocer::NewsstandNotification.new(device_token: "...")
# Generates a JSON payload like:
# {"aps": {"content-available": 1}}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top