本文介绍了GCM注册令牌的冒号是否有效?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下代码获取DCM注册令牌
String token =NoREG;
尝试{
InstanceID instanceID = InstanceID.getInstance(getApplicationContext());
token = instanceID.getToken(xxxxxxxxxxxxxx,
GoogleCloudMessaging.INSTANCE_ID_SCOPE,null);
Log.i(TAG,GCM注册令牌:+令牌);
} catch(Exception e){
Log.d(TAG,Failed to complete token,e);
}
我以不同寻常的格式获得注册令牌,如
'pre>
dsYKKXPzztU:APA91bH2J5OqK9OHEp7p5RUJ46fO_zPAEhEgPugJBviEqAbPyFhozMoVh1Npk_s_7wwyzaJ0LjiFki3PYFZHByw4KdA6Ke0XdudOqe4LPhNPA-Y2nbblRHLPhEp3dWyjqCTEsQhwHw24
正如你可以看到它包含冒号,这让我感觉有些事情是错误的。这个格式是否正确?
请帮助
解决方案
GCM注册令牌的长度通常约为140个字符,可以包含冒号,下划线和连字符。最大尺寸应该是4k。 i am using the below code to get the DCM Registration token
String token = "NoREG";
try {
InstanceID instanceID = InstanceID.getInstance(getApplicationContext());
token = instanceID.getToken("xxxxxxxxxxxxxx",
GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
Log.i(TAG, "GCM Registration Token: " + token);
} catch (Exception e) {
Log.d(TAG, "Failed to complete token", e);
}
i am getting the registration token in an unusual format like
dsYKKXPzztU:APA91bH2J5OqK9OHEp7p5RUJ46fO_zPAEhEgPugJBviEqAbPyFhozMoVh1Npk_s_7wwyzaJ0LjiFki3PYFZHByw4KdA6Ke0XdudOqe4LPhNPA-Y2nbblRHLPhEp3dWyjqCTEsQhwHw24
as you can see it contains a colon, which makes me feel some thing is wrong. is this format correct??please help
解决方案
The GCM registration token is usually around 140 chars in length, and can contain colons, underscores and hyphens. Maximum size is supposed to be 4k.
这篇关于GCM注册令牌的冒号是否有效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!