public void unregisterGCM(LobbySession session,String key) {
try {
database.startTransaction();
User user = getUser(session);
if (LobbyServer.equals(user.getAndroidId(), key)) {
user.setAndroidId(null);
database.saveUser(user);
send(session, ProtoLobby.COMMAND_ANDROID_UNREGISTER_DONE, null);
}
else {
throw new IllegalStateException("android "+user.getAndroidId()+" "+key);
}
}
finally {
database.endTransaction();
}