In Google Cloud Messaging, what is exactly the registration ID maximum length?
A google engineer said the registration ID can be up to 4K.
Users have observed it is 255 characters.
i think i can help you out with this... i´m working with GCM this week, and my device´s registration ID looks like this:
APA91bHPRgkF3JUikC4ENAHEeMrd41Zxv3hVZjC9KtT8OvPVGJ-hQMRKRrZuJAEcl7B338qju59zJMjw2DELjzEvxwYv7hH5Ynpc1ODQ0aT4U4OFEeco8ohsN5PjL1iC2dNtk2BAokeMCg2ZXKqpc8FXKmhX94kIxQ
163 characters!
i hope this can help you out...
On iOS all my registration tokens look like this:
lhBV25_Znsk:APA91bHFM9nbX-s0py6-ktzgdpP_y85RahdL3OJ4LG4v-jT_9QY8ZbZH8uK-JNO_BDy75b6RfDT-v-j5W0FXIFTif72ckT3kqLNBDNWYSd5AhxYwdJi3Wqfdqqi-wL8F_k1nm2qUS3Ra
(152 chars)
Note the colon after 11 characters. Note also that it has the sequence "APA..." AFTER the colon, however you should use the whole registration token.
There's no official limit for GCM ID, the payload size is 4k when I am writing this. Although, it is safe to assume 255 for GCM ID according to this and the discussion before me.
If it is in database that you are asking the question for, I suggest that you use TEXT.
来源:https://stackoverflow.com/questions/11324666/android-gcm-registration-id-max-length