locked
Azure Notification Hub device registration RRS feed

  • Question

  • User383458 posted

    Since AppCenter retiring at the end of this year, I have started migrating to Azure-Notification-Hub. But the documentation for notification-hub is not clear at all. Especially the documentation for Xamarin.Android. It does not match with their latest SDK.

    In the latest (version 1.1.1) azure-notification-hub SDK for Android (or Xamarin.Android) there's no need to implement FirebaseMessagingService. NotificationHub.Start() method registers the device in the Notification-Hub. A device registered with this way gets notifications without any problem.

    NotificationHub.Start(Application, <HubName>, <ConnectionString>);
    

    Addition tags to existing NotificationHub instance are also straightforward with the new SDK.

    NotificationHub.AddTag("username:user123");
    

    But in Registration Management official doc states that devices can register with the notification-hub either from client-side or from server-side. Is it necessary to use one of those methods if my app registered with the notification-hub using the NotificationHub.Start() method? Or do I missing something?

    Also, when I was using the AppCenter, I have used the AppCenter-InstallId to target a specific device. With that in mind is it possible to use the NotificationHub.InstallationId to use as a tag (eg: "handle:<devce's InstallationId>") to send device-specific notifications?

    Monday, November 9, 2020 12:57 PM

Answers

  • User382871 posted

    With that in mind is it possible to use the NotificationHub.InstallationId to use as a tag ... to send device-specific notifications? The installation model supports a special tag format ($InstallationId:{INSTALLATION_ID}) that enables sending a notification directly to the specific device. When you've used NotificationHub.start(...), it will generate one for you if you do not specify an InstallationId.

    Is it necessary to use one of those methods if my app registered with the notification-hub using the NotificationHub.Start() If you don't host your own backend or swap out the InstallationAdapter to be a class that invokes your API, it't not required to do registration action

    For more details, you could refer to MarStr's explanation. https://stackoverflow.com/questions/64752083/azure-notification-hub-device-registration

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, November 11, 2020 9:17 AM

All replies

  • User382871 posted

    With that in mind is it possible to use the NotificationHub.InstallationId to use as a tag ... to send device-specific notifications? The installation model supports a special tag format ($InstallationId:{INSTALLATION_ID}) that enables sending a notification directly to the specific device. When you've used NotificationHub.start(...), it will generate one for you if you do not specify an InstallationId.

    Is it necessary to use one of those methods if my app registered with the notification-hub using the NotificationHub.Start() If you don't host your own backend or swap out the InstallationAdapter to be a class that invokes your API, it't not required to do registration action

    For more details, you could refer to MarStr's explanation. https://stackoverflow.com/questions/64752083/azure-notification-hub-device-registration

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, November 11, 2020 9:17 AM
  • User383458 posted

    @Jarvan thank you for your time! The new API ease the AppCenter migration with a minimal amount of work. Kudos to that.

    Thursday, November 12, 2020 3:17 AM
  • User383458 posted

    For anyone looking for implementing Azure Notification Hub with Xamarin, this repo might help: https://github.com/Azure/azure-notificationhubs-xamarin.

    Thursday, November 12, 2020 3:18 AM