2013-04-03 76 views
1

我已經註冊的設備從谷歌服務器和myServer,如果我手動註銷設備從谷歌服務器,但不是從myServer我不斷從myServer獲取通知。 我打電話GCMRegistrar.unregister(context); 和呼叫後去GCMIntentService進入方法GCM手動取消註冊從谷歌服務器不工作

@Override 
    protected void onUnregistered(Context context, String registrationId) { 
     Log.i(TAG, "Device unregistered"); 
     if (GCMRegistrar.isRegisteredOnServer(context)) { 
      //ServerUtilities.customUnregister(context, registrationId); 
     } else { 
      // This callback results from the call to unregister made on 
      // ServerUtilities when the registration to the server failed. 
      Log.i(TAG, "Ignoring server unregister callback"); 
     } 
    } 

我讀過這developer.android how unRegistration works但它沒有明確的對我 爲什麼我總是收到通知? tnks迴應

回答

1

註銷gcm事件後,您應該註銷您的第三個服務器端應用程序。

protected void onUnregistered(Context context, String registrationId) { 
     Log.i(TAG, "Device unregistered"); 
     if (GCMRegistrar.isRegisteredOnServer(context)) { 
      ServerUtilities.customUnregister(context, registrationId); // here 3rd server side unregister 
     } else { 
      // This callback results from the call to unregister made on 
      // ServerUtilities when the registration to the server failed. 
      Log.i(TAG, "Ignoring server unregister callback"); 
     } 
    } 
+0

如果我不在myServer上註冊,雖然我從Google服務器上刪除將繼續收到通知?不可能?如果是的話,我問自己爲什麼要打電話給GCMRegistrar.unregister(context)? – Scorpy86

+0

yes.You should unregister from your server。完全取消註冊僅適用於第三臺服務器 – Yahor10

+0

您可以從客戶端調用取消註冊事件 - 即GCMRegistrar.unregister(上下文)執行 – Yahor10