본문 바로가기

개발 관련 지식/안드로이드(Android)

[안드로이드] GCM 서버 JSON 파라미터 정보

* GCM 서버 JSON 파라미터 정보

 

- registration_ids

: array로 1~1000 개의 아이디 입력 가능

 


- collapse_key

: 메시지 타입을 그룹화하는 기능으로 해당 단말이 off 일 경우 가장 최신 메세지만 전달되는 형태

 


- data

: key-value pair

 


- delay_while_idle

: message 가 바로 전송되는 것이 아니라, phone 이 on 되었을 때 collapse_key 의 가장 마지막 메시지만 전송되도록 설정


 If the device is connected but idle, the message will still be delivered right away unless the delay_while_idle flag is set to true. Otherwise, it will be stored in the GCM servers until the device is awake.


 "true" 또는 "false" 값에 따라 수신되는 동작을 변경할 수 있다.

false : 화면이 꺼진 후 스마트폰이 idle 상태가 된 상태에서도 GCM 은 바로 수신

true : GCM 서버에 저장되었다가 스마트폰이 켜질때(awake) 수신



- time_to_live

: 단말이 off 일 때 GCM storage 에서 얼마나 저장되어야 하는지 설정하는 값으로 collapse_key 와 반드시 함께 설정되야 함

 

[참고] time_to_live 값의 범위

: 0 ~ 2,419,200sec(4주)

The Time to Live (TTL) feature lets the sender specify the maximum lifespan of a message using the time_to_live parameter in the send request. The value of this parameter must be a duration from 0 to 2,419,200 seconds, and it corresponds to the maximum period of time for which GCM will store and try to deliver the message. Requests that don't contain this field default to the maximum period of 4 weeks.

[사이트] http://developer.android.com/google/gcm/adv.html

 

[참고 사이트]

https://developers.google.com/cloud-messaging/server#ttl