Skip to content

Advanced APNs Features

Jorge Oliveira Santos edited this page Oct 9, 2019 · 3 revisions

Mobile Device Management

n = Rpush::Apns::Notification.new
n.mdm = "magic"
n.save!

Assigning a Hash to alert

Please refer to Apple's documentation (Tables 3-1 and 3-2).

Custom Headers

There might be some cases where you'll need to add extra headers to the APNS call. E.g. From iOS 13 onwards, silent notifications can only be sent if you include the apns-push-type header with the background value. More details on custom headers here.

To include a custom header, simply include the headers hash on your notification payload:

n = Rpush::Apnsp8::Notification.new
n.data = {
  'headers' => {
    'apns-push-type' => 'background'
  }
  <rest of your payload here>
}

Clone this wiki locally