GCM - Maximum Registration Identifier Length

What is the maximum length of a registration identifier issued by GCM servers? GCM documentation does not provide this information. Google for this shows that the registration identifier does not have a fixed length and can be up to 4K (4096 bytes) in length. But these are not official answers from Google. I am currently receiving registration IDs that are 162 characters long. Can anyone help?

+47
push-notification google-cloud-messaging
Jul 26 2018-12-12T00:
source share
3 answers

I am also interested to know about this. The size of my register is 183 characters. I suspect it will be no longer than 512 characters, though, not to mention 4K. Imagine you are sending a bulk notification, size 4K reg id x 1000 = 4MB!

In the end, I just use the type “text” in my MySQL table to store the registration identifier. So even if google sends me 1K, 2K or 4K (very unlikely) reg id, I can handle it.

Update: I encountered a new reg id number: 205.

+21
Jul 26 '12 at 14:52
source share

On android-gcm forum google developer confirms it 4k

+42
Nov 29
source share

This is what was said in the GCM document,

A JSON object whose fields represent the key-value pairs of the message payload data. If available, the payload data will be included in the intent as application data, with the key being an alternate name. For example, "data": {"score": "3x1"} will result in an additional named intent whose value is a 3x1 string.

There is no limit to the number of key / value pairs, although there is a limit to the total message size (4kb). Values ​​can be any JSON objects, but we recommend using strings, because the values ​​will still be converted to strings in the GCM server.

If you want to include objects or other non-string data types (for example, integers or booleans), you need to convert to a string yourself. Also note that the key cannot be a reserved word (from or any word starting with google.).

To complicate matters, there are some reserved words (such as collapse_key) that are technically permitted in the payload data. However, if the request also contains a word, the value in the request will overwrite the value in the payload data. Therefore, the use of words that are defined as field names in this table is not recommended, even when they are technically permitted. Not necessary.

0
Mar 29 '13 at 9:17
source share



All Articles