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.

Bradley Dean's Picture

About Bradley Dean

Certified Xamarin Mobile Developer with experience in Xamarin Forms, Ionic, Cordova, Phone Gap, ASP.Net MVC, Web Services, and sarcasm.

Atlanta, GA http://truegeek.com