我可以用apn_on_rails推送报亭通知吗?

时间:2013-01-31 11:13:51

标签: ios ruby-on-rails-3 push-notification apple-push-notifications newsstand-kit

有没有办法使用apn_on_rails推送报亭通知?即推这种有效载荷:

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

目前I can see我可以通过徽章,声音和提醒推送通知。

我敢肯定,如果事实证明apn_on_rails还没有做到,那就很难修改apn_on_rails本身。 apn_on_rails有很多分支,我现在正在使用this one

2 个答案:

答案 0 :(得分:3)

APN::Notification类具有custom_properties属性,您可以使用该属性在推送通知中包含任何通用数据。以您的有效负载为例,您可以这样做:

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

答案 1 :(得分:1)

Grocer还支持报亭通知。 https://github.com/grocer/grocer#newsstand-notifications

notification = Grocer::NewsstandNotification.new(device_token: "...")
# Generates a JSON payload like:
# {"aps": {"content-available": 1}}
相关问题