Question 122 of 179 from exam AZ-204: Developing Solutions for Microsoft Azure

Question 122 of 179 from exam AZ-204: Developing Solutions for Microsoft Azure

Question

HOTSPOT - You develop a news and blog content app for Windows devices.

A notification must arrive on a user's device when there is a new article available for them to view.

You need to implement push notifications.

How should you complete the code segment? To answer, select the appropriate options in the answer area.

NOTE: Each correct selection is worth one point.

Hot Area:

Answer Area

string notificationHubName = "contoso_hub";
string notificationHubConnection = “connection_string";
v hub =

NotificationHubClient

Noti nHubClientSettings
Noti nHubJob
NotificationDetails

NotificationHubClient___ GetInstallation

No nHubClientSettings CreateClientFromConnectionString
No nHubJob CreateOrUpdatelnstallation
NotificationDetails Patchinstallation

(notificationHubConnection, notificationHubName) ;
string windowsToastPayload =

@"<toast><visual><binding template=""ToastText@1""><text id: +

@"New item to view" + @"</text></binding></visual></toast>";

try

{

var result =

await hub. v (windowsToastPayload) ;

SendWindowsNativeNotificationAsync
SubmitNoti nHubJobAsync
ScheduleNotificationAsync
SendAppleNativeNotificationAsync

3

catch (System.Exception ex)

{

Explanations

Answer Area

string notificationHubName = "contoso_hub";
string notificationHubConnection = “connection_string";
v hub =

NotificationHubClient

Noti nHubClientSettings
Noti nHubJob
NotificationDetails

| NotificationHubClient | GetlInstallation

No nHubClientSettings CreateClientFromConnectionString
No nHubJob CreateOrUpdatelnstallation
NotificationDetails Patchinstallation

(notificationHubConnection, notificationHubName) ;
string windowsToastPayload =

@"<toast><visual><binding template=""ToastText@1""><text id: +

@"New item to view" + @"</text></binding></visual></toast>";

try

{

var result =

await hub. v (windowsToastPayload) ;

SendWindowsNativeNotificationAsync |
SubmitNoti nHubJobAsync
ScheduleNotificationAsync
SendAppleNativeNotificationAsync

3

catch (System.Exception ex)

{

Box 1: NotificationHubClient - Box 2: NotificationHubClient - Box 3: CreateClientFromConnectionString // Initialize the Notification Hub NotificationHubClient hub = NotificationHubClient.CreateClientFromConnectionString(listenConnString, hubName); Box 4: SendWindowsNativeNotificationAsync Send the push notification.

var result = await hub.SendWindowsNativeNotificationAsync(windowsToastPayload); Reference: https://docs.microsoft.com/en-us/azure/notification-hubs/notification-hubs-push-notification-registration-management https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/app-service-mobile/app-service-mobile-windows-store-dotnet-get-started-push.md.