1
votes

I'm trying to send a notification to my Android device using Azure Notification Hub.

When I use the Test Send functionality which is available in Azure Notification Hub it doesn't seem to care about the property "to" in the payload. For example if I specify a fake deviceId like below I still receive a notification on my device.

{
"to" : "fW4Xab4JY3F:ERT91bHC4_hqzGj4AaHB_u1Dvzai6hFxyHFscgQ_TRAqWD1JGsE7FqFmknSuwlCEImmyn9R1gCDpsObZk33mpqaqdhWC_712AW2PI47ni15Jyrwq12xcSs9tZ784sLabz2I64J2LSe4q",
"notification": {
"title": "TITel",
"body": "Firebase Cloud Message"
  }
}

If I do the same using Postman and calls the server side API of FCM I get a response saying InvalidRegistration if I enter a fake deviceId. And if I use a correct deviceId I get the notification as expected.

Anyone knows why the payload isn't working as I would expect it to within Azure Notification Hub?

1

1 Answers

2
votes

Test Send is for testing only. The way it works is it sends notifications to 10 random devices. I guess the reason why it works for you from NH is probably because you have a few devices (or maybe even just 1 device) so all of them get notifications.

The reason why it doesn't work with FCM is because, as you mentioned, this is a fake ID. If you use an existing one, it should work.