Brad Dean

Xamarin Remote Notifications

If you’re following the Azure Notifications Hub documentation you’ve probably used this for your iOS notification message:

{
   "aps" : {
       "alert" : "Notification text goes here"
   },
}

This works, but note that if you want a sound to play when the notification is received, you want to change it to this:

{
  "aps" : {
      "alert" : "Notification text goes here",
      "sound" : "default"
  },
}

This will play the default sound automatically for notifications received when the app is closed. You don’t need to do anything.

If the app is open you’ll need to catch the “sound” key in NotificationReceived in your AppDelegate just like you catch the “alert” key.