APNS icon indicating copy to clipboard operation
APNS copied to clipboard

Silent Push Notification

Open p581581 opened this issue 11 years ago • 5 comments

Hi jpoz,

I'm trying to use silent push notification, and it seen need to provide the key "content-available" with a value of 1, so that I can use it. But, when I write:

APNS.send_notification(device_token, :content-available => 1}

It'll send a syntax error message. How can I solve it?

p581581 avatar Jan 13 '15 06:01 p581581

Hi p581581

Check your parenthesis

APNS.send_notification(device_token, :content-available => 1}
vs
APNS.send_notification(device_token, :content-available => 1)

eplewis89 avatar Jan 29 '15 21:01 eplewis89

You have to use an underscore instead of a dash APNS.send_notification(device_token, :content_available => 1)

sebromero avatar Jan 30 '15 19:01 sebromero

@sbhklr interesting behavior we noticed with underscore actually. Apple won't deliver the message if we use the underscore option. However, 'content-available' doesn't do what it's supposed to do if we pass that.

sarmiena avatar Feb 22 '15 02:02 sarmiena

@sarmiena Works for me. If you pass the symbol :content_available => 1 as a parameter the script sends "content-available" under the hood. Have a look at the source code.

sebromero avatar Feb 22 '15 12:02 sebromero

@sbhklr its works for me as well. Thank you.

suvarnakanade avatar Mar 21 '16 12:03 suvarnakanade