구글 문서를 보다보니 해석이 헷깔리네요.

if (error.equals(Constants.ERROR_NOT_REGISTERED))

의경우는 어플이 삭제되었다라는 의미 잘 이해 했구오.

 if (canonicalRegId != null) 에서


 same device has more than on registration ID: update database 의 의미가


 기존의 registraion ID가 canonicalRegId  로 변경되었으니 다음부터는 canonicalRegId  값으로


날려라 이뜻인가요? 헷깔리네요.



Message message = new Message.Builder().addData("msg", strMessage).build();


List<String> list = new ArrayList<String>();

list.add(regId);


MulticastResult multiResult = sender.send(message, list, 5);


if (multiResult != null) {

List<Result> resultList = multiResult.getResults();


for (Result result : resultList) {

if(result.getMessageId() != null)

{

System.out.println(result.getMessageId());

String canonicalRegId = result.getCanonicalRegistrationId();

if (canonicalRegId != null) {

  // same device has more than on registration ID: update database

 

System.out.println("same device has more than on registration ID: update database");

}

}

else

{

String error = result.getErrorCodeName();

if (error.equals(Constants.ERROR_NOT_REGISTERED)) {

  // application has been removed from device - unregister database

System.out.println("application has been removed from device - unregister database");

}

}

}  

}