Registration Azure Notification Hub in WebApi backend from Android client

We are using Asp.Net WEBAPI 2.2 with OWIN middleware for authentication. We try to integrate Azure Notification Hub for our platform. However, we could not find a best way for registrating our Android client to Azure Notification Hub through our WEBAPI backend.

Should we call another registration method after Token endpoint returns access token?,

What should we do with the registration id that notification hub returns?,

Instead of generating registration id, couldn't we use userid for our authenticated push notifications?,

and finally, is there any tutorial tells explicitly how can we authenticated push notifications from WEBAPI to Android, because official tutorials are not enough

Upvotes: 2

Views: 716

Answers (1)

Baris Akar
Baris Akar

Reputation: 4965

  • After you get the GCM RegistrationId/Token/Handle, you need to register at your Azure Notification Hub with it and you will get an Azure Notification Hub RegistrationId that is different from the GCM RegistrationId.
  • Your app needs to store that ANH RegistrationId to update its registration on each app start, your backend doesn't necessarily need the ID.
  • You can add the User ID as a tag to the registration to identify the registrations using the User ID, see the following linked tutorial.
  • This official tutorial is exactly what you need: Azure Notification Hubs Notify Users - Android, WebAPI.

Upvotes: 1

Related Questions