注册UWP(WinJS)应用程序以接收DEV中心通知

时间:2017-04-11 08:29:52

标签: uwp windows-store-apps winjs

我在注册我的应用程序以接收来自开发中心的通知时遇到了问题。

我正在按照本教程配置应用程序(link),这是我的JS(WinJS应用程序)代码:

Microsoft.Services.Store.Engagement.StoreServicesEngagementManager.getDefault().registerNotificationChannelAsync();

我打电话给"激活" " WinJS.Application"。

的事件

当我控制台记录响应时,我收到了通道URI,所以我认为它是正确的,但是当我打开DEV中心并创建新的"要求评级"通知,我收到此消息: "您必须将应用配置为使用Microsoft Store Services SDK接收通知。"

应用程序已在商店中签名,但仍无效。

拜托,有人可以帮我吗?我做错了什么?

谢谢

1 个答案:

答案 0 :(得分:1)

我测试下面的代码,它在开发中心没有警告的情况下工作。

public App()
    {
        this.InitializeComponent();
        this.Suspending += OnSuspending;

        RegisterEngagementNotification();

    }

    private async void RegisterEngagementNotification()
    {
        StoreServicesEngagementManager engagementManager = StoreServicesEngagementManager.GetDefault();
        await engagementManager.RegisterNotificationChannelAsync();
    }

您需要将项目与开发人员中心中的应用名称相关联并运行您的代码。然后返回开发中心并创建通知。

<强>更新

我还测试了您提供的视频中的代码,效果很好:

   app.onactivated = function (args)
{
    notification.StoreServicesEngagementManager.getDefault().registerNotificationChannelAsync();

}

只需确保将项目与商店中的应用名称相关联,然后运行它以构建频道。

enter image description here