android GCM注册ID最大长度

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11324666/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 06:58:09  来源:igfitidea点击:

android GCM registration ID max length

androidgoogle-cloud-messaging

提问by Dahevos

In Google Cloud Messaging, what is exactly the registration ID maximum length?

在 Google Cloud Messaging 中,注册 ID 的最大长度究竟是多少?

回答by rds

A google engineer said the registration ID can be up to 4K. Users have observed it is 255 characters.

一位谷歌工程师表示,注册ID最高可达4K。用户观察到它是 255 个字符。

回答by VaroX

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:

我想我可以帮你解决这个问题……我这周正在使用 GCM,我的设备的注册 ID 看起来像这样:

APA91bHPRgkF3JUikC4ENAHEeMrd41Zxv3hVZjC9KtT8OvPVGJ-hQMRKRrZuJAEcl7B338qju59zJMjw2DELjzEvxwYv7hH5Ynpc1ODQ0aT4U4OFEeco8ohsN5PjL1iC2dNtk2BAokeMCg2ZXKqpc8FXKmhX94kIxQ

APA91bHPRgkF3JUikC4ENAHEeMrd41Zxv3hVZjC9KtT8OvPVGJ-hQMRKRrZuJAEcl7B338qju59zJMjw2DELjzEvxwYv7hH5Ynpc1ODQ0aT4U4OFEeco8ohsN5PjL1iC2dNtk2BAokeMCg2ZXKqpc8FXKmhX94kIxQ

163 characters!

163个字!

i hope this can help you out...

我希望这可以帮助你...

回答by Lukasz Czerwinski

On iOS all my registration tokens look like this:

在 iOS 上,我所有的注册令牌都是这样的:

lhBV25_Znsk:APA91bHFM9nbX-s0py6-ktzgdpP_y85RahdL3OJ4LG4v-jT_9QY8ZbZH8uK-JNO_BDy75b6RfDT-v-j5W0FXIFTif72ckT3kqLNBDNWYSd5AhxYwdJi3Wqfdqqi-wL8F_k1nm2qUS3Ra

(152 chars)

(152 个字符)

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.

注意 11 个字符后的冒号。另请注意,它在冒号后具有序列“APA...”,但是您应该使用整个注册令牌。

回答by Mayank

There's no official limit for GCM ID, the payload sizeis 4k when I am writing this. Although, it is safe to assume 255 for GCM ID according to thisand the discussion before me.

GCM ID 没有官方限制,当我写这篇文章时,有效载荷大小是 4k。尽管如此,根据本文和我之前的讨论,可以安全地假设 GCM ID 为 255 。

If it is in database that you are asking the question for, I suggest that you use TEXT.

如果您要问的问题是在数据库中,我建议您使用 TEXT。