我想为我的安卓应用程序生成设备唯一标识符,以便根据用户设备UDID创建收藏夹。
所有设备都有唯一的标识符。
import android.provider.Settings.Secure;
private String android_id = Secure.getString(getContext().getContentResolver(),
Secure.ANDROID_ID);
private String uDiD = Secure.getString(getContext().getContentResolver(),
Secure.ANDROID_ID);
您可以使用不同的值作为设备唯一标识符(UDID)。 上述提到的Secure.ANDROID_ID有一些缺点: 它可能为空; 在某些2.2和4.2设备上相同; 您可以使用设备的Mac地址或IMEI地址(在没有蜂窝连接的设备上可能为空)。