C++应用程序中的Azure通知中心



在Microsoft文档中,有一个C#实现Azure通知中心的例子——https://learn.microsoft.com/en-us/azure/notification-hubs/notification-hubs-windows-store-dotnet-get-started-wns-push-notification#create-a样本窗口应用

private async void InitNotificationsAsync()
{
var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
var hub = new NotificationHub("<your hub name>", "<Your DefaultListenSharedAccessSignature connection string>");
var result = await hub.RegisterNativeAsync(channel.Uri);
// Displays the registration ID so you know it was successful
if (result.RegistrationId != null)
{
var dialog = new MessageDialog("Registration successful: " + result.RegistrationId);
dialog.Commands.Add(new UICommand("OK"));
await dialog.ShowAsync();
}
} 

但我们的应用程序使用C++,我们在WinRT/C++文档中找到了部分示例代码:https://learn.microsoft.com/en-us/uwp/api/windows.networking.pushnotifications.pushnotificationchannelmanager?view=winrt-22621

但没有Azure代码的一部分:

var hub = new NotificationHub("<your hub name>", "<Your DefaultListenSharedAccessSignature connection string>");

这是否意味着,对于那些只使用C++的应用程序来说,Azure消息是不可能的主题?

目前,只有少数Azure服务可以使用c++SDK。您可以在这里办理登机手续:

https://azure.github.io/azure-sdk/cpp_introduction.html

但是,您可以直接与RESTApi:交互

https://learn.microsoft.com/en-us/rest/api/notificationhubs/create-update-registration

最新更新