title: Trouble setting push notification badge for Android and iOS using Xamarin Forms
body: <p>I'm having trouble with the icon badge using push notifications on my Xamarin Forms app. I'm using Firebase to send the app to both devices.</p>
  
  <p>The way I had the badge working for android was that the app gets the complete notification info from the payload's 'data' section. When the notification only has a data section I can trigger a function that will set the badge and show the popup notification. If I put the same info in the 'notification' section I can't cause a trigger to set the badge.</p>
  
  <p>For iOS, the badge count gets sent from the payload's 'notification' section. iOS doesn't see the 'data' section and create an automatic popup. I've tried triggering a function when the app is in the background but couldn't find a way.</p>
  
  <p>Bottom line: iOS needs the 'notification' payload and Android needs the 'data' payload to show the proper badge.</p>
  
  <p>Does anyone know how I can trigger a function in my AppDelegate on iOS when the app is in the background and a push notification is received and/or does anyone know how to trigger a function in Android when there is a 'notification' section in the payload?</p>
  
  <p>This is my payload:</p>
  
  <pre><code>{
      "to":"{mytoken}",
      "notification":{
          "title":"Appointment Almost Booked",
          "body":"Please confirm your appointment",
          "badge":3
      },
      "data":{
          "title":"Appointment Almost Booked",
          "body":"Please confirm your appointment slot",
          "badge":3
      }
  }
  </code></pre>