关于Azure Notification Hub注册及设备定向通知的技术问询
1. Do you need additional registration after using NotificationHub.Start()?
Absolutely not! The NotificationHub.Start(Application, <HubName>, <ConnectionString>) method in the latest (1.1.1) Xamarin.Android SDK already handles the client-side registration flow entirely for you.
Here's what this method does under the hood:
- Automatically retrieves the FCM token for your device
- Registers the device with your Notification Hub instance
- Establishes a persistent link between the device and the hub
The official documentation mentioning client-side/server-side registration is a general overview—NotificationHub.Start() is the simplified, SDK-native way to handle client-side registration. You don't need to implement a custom FirebaseMessagingService or run any extra registration steps.
And when you call NotificationHub.AddTag("username:user123"), this directly updates the existing registration record created by Start()—so that works exactly as you expect.
2. Can you use NotificationHub.InstallId as a tag for device-targeted notifications?
Yes, this is a perfectly valid and common approach to replicate the AppCenter-InstallId targeting behavior!
You can create a unique tag like handle:<device's InstallationId> (e.g., handle:abc123xyz) by using the NotificationHub.InstallId value. Since the InstallId is a unique identifier for each device instance, adding this tag lets you send notifications directly to that specific device by targeting the tag in your notification send request.
This mirrors how you used AppCenter-InstallId, and it’s fully supported by Azure Notification Hubs. Just make sure to add the tag right after calling NotificationHub.Start() to ensure it’s attached to the device’s registration record.
内容的提问来源于stack exchange,提问作者Tharindu

