使用 Xamarin 和 Azure 启用 Google 云消息传递 API

Enable Google Cloud Messaging API with Xamarin and Azure

我尝试遵循 Microsoft Azure 的 guide to setup Push Notification with Android. But at step 4 I am stucked, as I can not find any places to enable the API for Push Notification, as the link leads to Firebase Cloud Messaging,但我无法使用,因为我也需要为 Windows 提供我的应用程序。

Azure 需要 GCM,但是当我使用 GCM 设置它时,它失败并显示错误代码 401。我该怎么办?

我不认为 N​​ikunji 的回答有帮助。您正在使用 xamarin 开发跨平台应用程序。您应该遵循 this 指南,而不是 Microsoft Azure 的指南,因为 Azure 指南 just for Android.

祝你好运!

编辑:根据评论,我认为您应该看看 this and this

... the link leads to Firebase Cloud Messaging, which I can not use, since I need to provide my app for Windows too

为Windows商店注册您的应用 部分 Getting started with Notification Hubs for Windows Universal Platform Apps 您在寻找什么?如果我理解正确的话,您不是在寻找特定于 Xamarin 的代码,而是在寻找如何设置集线器以推送到 Windows 设备。如有不妥,请在本回答的评论中说明。

... the problem is, that Android is based upon GCM, and they now are using FCM

Notification Hubs: how to Enable Firebase cloud messaging 提供相关信息。