MAUIverse MAUIverse

Push Notifications with Azure Notification Hub, Part 2: Setting Up .NET MAUI

With the hub configured, the app itself needs to register its device and handle incoming messages. Vladislav walks through the Android path first: adding google-services.json, referencing the Microsoft.Azure.NotificationHubs package, requesting the right manifest permissions, and registering the device from MainActivity. A small DeviceInstallationService obtains the Firebase token and sends the registration request to the hub, and a FirebaseMessagingService subclass overrides OnMessageReceived to react to notifications.

Windows is simpler. No extra packages are needed; the app creates a push notification channel with PushNotificationChannelManager in App.xaml.cs and registers it with the hub.

One security note stands out: use the listen-only access signature in client apps, never the full-access one. The post ends by sending a test notification from the Azure portal, and the full code is on GitHub for comparison.

View Source →

← Back to Community Feed

}