AddPushAzureNotificationHubs working via Azure portal Test, but not via Microsoft.Azure.NotificationHubs SDK #1588
-
I have followed the Shiny docs, and I have the following line in my MauiProgram.cs: builder.Services.AddPushAzureNotificationHubs("my endpoint", "myhub") I request registration:
And I get a HEX token 32 characters long for both iOS and Android clients (on real hardware). If I test via Azure Portal -> notification hub -> overview -> Test send, the message pops up on the relevant iOS or Android device if my App is in the background, and the PushDelegate public async Task OnReceived(PushNotification notification) fires with the relevant push message if the app is in the foreground. All is fine up to this point. However, if I now try to use that RegistrationToken to send a device based message into Azure notification hub, the message never seems to reach either the iOS or Android device. This is an extract from my server side push code:
The state of the message is shown as "Enqueued". I am either doing something wrong with the server side code immediately above, or the RegistrationToken returned by the RequestAccess is an incorrect format. Can anyone help please? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@mikeasharp If you have a bug, this is not the place for it because it misses so many questions that the issue template requests. The azure push provider supplies a guid which is sent as the installation ID to Azure. There is so many mechanics involved in azure push that it is impossible to guess where the issue could be. Enqueued is too early... the message takes a few seconds to send, so you need to await the completion and then check if there is an error. You also need to look at the logs in Azure. There is also the use of tags if you're still having issues. This is about all I can offer in terms of help for this. |
Beta Was this translation helpful? Give feedback.
-
Hi, Right - that actually helps a lot. I thought it was the deviceToken, where in fact it is the InstallationId tag Changing my code to:
and the server send function now works. Thanks for the prompt reply. |
Beta Was this translation helpful? Give feedback.
@mikeasharp If you have a bug, this is not the place for it because it misses so many questions that the issue template requests.
The azure push provider supplies a guid which is sent as the installation ID to Azure. There is so many mechanics involved in azure push that it is impossible to guess where the issue could be. Enqueued is too early... the message takes a few seconds to send, so you need to await the completion and then check if there is an error. You also need to look at the logs in Azure. There is also the use of tags if you're still having issues.
This is about all I can offer in terms of help for this.