是Android设备ID和设备令牌有什么区别? [英] What is difference between android device id and device token?

查看:184
本文介绍了是Android设备ID和设备令牌有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到Android设备ID从这个$ C $片断C的是为我的设备是3b3472d8998af818

I am getting android device id from this code of snippet which is for my device is "3b3472d8998af818"

protected String getDeviceId() {
    return Secure.getString(this.getContentResolver(), Secure.ANDROID_ID);
}

和从该$ C $片断C的是为我的设备是Android设备令牌
<$c$c>APA91bGeA3xOsXocz-eNOklONNVYwHyjvzyVMPQtC54_GX5Npx5fjWjpDbw6XOGqFi-a0lz7gL4BQlZXN-opPyHwJxxo3-1jyqjc1df6y8KwdVj7tUHVObcE3sF0XSpSngUkq6UfCEUTwgmsv-sjGuK863Y4R1kmHA

and android device token from this code of snippet which is for my device is
APA91bGeA3xOsXocz-eNOklONNVYwHyjvzyVMPQtC54_GX5Npx5fjWjpDbw6XOGqFi-a0lz7gL4BQlZXN-opPyHwJxxo3-1jyqjc1df6y8KwdVj7tUHVObcE3sF0XSpSngUkq6UfCEUTwgmsv-sjGuK863Y4R1kmHA

GCMRegistrar.register(this.context, CommonUtilities.SENDER_ID);

我不知道什么是两个ID?

I don't know what is the difference between two ids?

推荐答案

这两个是完全不同的。

Both are completely different.

Secure.ANDROID_ID

一个64位数字(作为一个十六进制字符串)是随机的产生   设备的首次启动,并应保持不变的寿命   设备。 (如果在执行出厂重置价值可能会改变   装置。)

A 64-bit number (as a hex string) that is randomly generated on the device's first boot and should remain constant for the lifetime of the device. (The value may change if a factory reset is performed on the device.)

GCMRegistrar.register(this.context,CommonUtilities.SENDER_ID); 为您提供了设备的registartion ID从的 GCM 。通过它,GCM唯一标识设备。

And GCMRegistrar.register(this.context, CommonUtilities.SENDER_ID); Gives you the registartion id of device from GCM. By which, GCM uniquely identifies the device.

另一个区别是 Secure.ANDROID_ID 可能改变当设备上进行恢复出厂设置。和登记ID定期得到改变。

Another difference is Secure.ANDROID_ID may change when factory reset is performed on the device. And Registration id gets changes periodically.

如果你是问有关 CommonUtilities.SENDER_ID 随后的此是项目数,它将被用于以后的GCM发件人ID

And if you are asking about CommonUtilities.SENDER_ID then This is your project number, and it will be used later on as the GCM sender ID

这篇关于是Android设备ID和设备令牌有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆