Search code examples
azure-notificationhub

azure notification hub, android devices category


for an app, I have multiple categories of notification on android devices on as in screenshot. enter image description here

Settings on categories are different, some show's lights, others play custom sounds, etc

what should be the appropriate payload to deliver the notification to the app with category. I have tried

{
    "notification":{
        "title":"Contact Pulse",
        "body":"This is a sample notification delivered by Azure Notification Hubs.",
        "category": "Local Notifications"  // tried with this
    },
    "category": "Local Notifications" // tried with this as well
}

Expected end result is when category is "Local Notification", play the custom sound and other category its silent. Notifications are delivered on every case, but it not behaving as per the channel configs.

note: above scenario works well with data: {} (handled at the app level), but doesn't work with notification: {}.


Solution

  • At time of writing, Azure Notification Hubs only supports the FCM Legacy HTTP server protocol. For this reason, you'll need to provide the notification category information as the "android_channel_id" as documented here.