我使用 GCM(Google Cloud Messaging)和 Azure 通知中心在 xamarin 环境中开发 Android 应用程序。
问题是:我不知道如何取消订阅以前的标签。即使我再次卸载安装 - 该应用程序仍会继续接收我之前订阅的每个标签的通知。
也许我需要实现这个功能:
protected override void OnUnRegistered(Context context, string registrationId)
{
throw new NotImplementedException();
}
最佳答案
我认为您需要在 Azure 通知中心取消注册。
protected override void OnUnRegistered(Context context, string registrationId)
{
if (hub != null)
hub.Unregister();
}
其中 hub
与您在 OnRegistered
中使用的 NotificationHub
相同
关于android - 如何在 Android 应用程序中从 Google Cloud Messaging 客户端取消注册,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33797648/