Android版的Azure通知中心注销 [英] Android Azure Notification hub unregister

查看:310
本文介绍了Android版的Azure通知中心注销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在与来自Azure的注销通知集线器有问题。

I'm having a problem with unregistering notification hub from Azure.

我使用的方法取消注册()是这样的:

I'm using method unregister() like this :

gcm = GoogleCloudMessaging.getInstance(getApplicationContext());

String connectionString = "xxx";
hub = new NotificationHub("xxx", connectionString, getApplicationContext());

try {
    gcm.unregister();
    hub.unregister();
    Log.d("GCM","Unregister");
} catch (IOException e) {
    e.printStackTrace();
} catch (Exception e) {
    e.printStackTrace();
};

我不明白在这个code任何异常,但我仍然得到推送通知。任何帮助将是preciated。先谢谢了。

I don't get any exception in this code, but I'm still getting push notification. Any help will be apreciated. Thanks in advance.

推荐答案

您不应该从GCM注销。

You shouldn't unregister from GCM.

为什么你应该很少注销

您应该只需要在极少数情况下,例如,如果要取消注册
  一个应用程序停止接收消息,或者如果您怀疑
  注册ID已经被入侵。一般情况下,一旦应用程序有一个
  注册ID,你不需要去改变它。

You should only need to unregister in rare cases, such as if you want an app to stop receiving messages, or if you suspect that the registration ID has been compromised. In general, once an app has a registration ID, you shouldn't need to change it.

在特别的,你永远不应该注销您的应用程序作为一种机制
  注销或用户之间的切换,其原因如下:

In particular, you should never unregister your app as a mechanism for logout or for switching between users, for the following reasons:


      
  • 一个注册ID未与用户的特定记录的关联。
      如果您注销,然后重新注册,GCM可以返还相同ID或
      不同的ID,也不能保证任何一种方式。

  • A registration ID isn't associated with a particular logged in user. If you unregister and then re-register, GCM may return the same ID or a different ID—there's no guarantee either way.

取消注册可能需要长达5分钟才能生效。

Unregistration may take up to 5 minutes to propagate.

注销后重新注册可能再次需要5分钟才能生效。在此期间,消息可能会因被拒绝
  到被状态
  未登记的,经过这一切,消息可能还是去错了
  用户。

After unregistration, re-registration may again take up to 5 minutes to propagate. During this time messages may be rejected due to the state of being unregistered, and after all this, messages may still go to the wrong user.

更多信息: http://developer.android.com/谷歌/ GCM / gcm.html#UNREG,为什么

由于您使用Azure的通知中心,你只需要在那里,而不是从GCM删除注册。

Since you are using Azure Notification Hub, you just need to delete registration from there, not from GCM.

这篇关于Android版的Azure通知中心注销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆