Android 设备 UDID 或唯一 ID?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11292411/
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:46:26  来源:igfitidea点击:

Android Device UDID or unique ID?

android

提问by Helal Khan

I want to generate android device unique id for my android application to create favourite according to user device udid.

我想为我的 android 应用程序生成 android 设备唯一 id,以根据用户设备 udid 创建收藏夹。

回答by Daniel

All devices have a unique id.

所有设备都有一个唯一的 ID。

 import android.provider.Settings.Secure;
 private String android_id = Secure.getString(getContext().getContentResolver(),
                                                            Secure.ANDROID_ID); 

回答by Farruh Habibullaev

private String uDiD = Secure.getString(getContext().getContentResolver(),
                                                        Secure.ANDROID_ID); 

回答by Ahsan Idrees

You can use different values as udid. The above mentioned Secure.ANDROID_ID has some cons It can be null It is same on 2.2 and some 4.2 devices You can use MacAddress of device or IMIE address(Can be null on devices without cellular connection)

您可以使用不同的值作为 udid。上面提到的 Secure.ANDROID_ID 有一些缺点 可以为 null 在 2.2 和一些 4.2 设备上是相同的 您可以使用设备的 MacAddress 或 IMIE 地址(在没有蜂窝连接的设备上可以为 null)