상세 컨텐츠

본문 제목

GCM(푸쉬) 전송 후 결과 메시지 분석하기

프로그램개발/안드로이드

by fsteam 2014. 5. 8. 21:14

본문

GCM(푸쉬) 전송 후 결과값을 받아서.. 경우에 따라 처리해야 된다.


아래는 안드로이드 개발자 센터의 도움말이다..


Here are JSON results for 6 recipients (IDs 4, 8, 15, 16, 23, and 42 respectively) with 3 messages successfully processed, 1 canonical registration ID returned, and 3 errors:

{ "multicast_id": 216,
 
"success": 3,
 
"failure": 3,
 
"canonical_ids": 1,
 
"results": [
   
{ "message_id": "1:0408" },
   
{ "error": "Unavailable" },
   
{ "error": "InvalidRegistration" },
   
{ "message_id": "1:1516" },
   
{ "message_id": "1:2342", "registration_id": "32" },
   
{ "error": "NotRegistered"}
 
]
}

In this example:

  • First message: success, not required.
  • Second message: should be resent (to registration ID 8).
  • Third message: had an unrecoverable error (maybe the value got corrupted in the database).
  • Fourth message: success, nothing required.
  • Fifth message: success, but the registration ID should be updated in the server database (from 23 to 32).
  • Sixth message: registration ID (42) should be removed from the server database because the application was uninstalled from the device.

* message_id : 정상 전송 됨.

* error - Unavailable : 재 전송 필요.

* error - 기타 : 서버에서 registration_id 삭제해야 함.


관련글 더보기