美文网首页
Android 平板电脑的设备ID

Android 平板电脑的设备ID

作者: 冉冉升起的小太阳 | 来源:发表于2017-06-15 17:47 被阅读217次
/*获取设备的 ID*/
    public static String getDeviceId(Context context) {
        String id;
        //android.telephony.TelephonyManager
        TelephonyManager mTelephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        if (mTelephony.getDeviceId() != null) {
            id = mTelephony.getDeviceId();
        } else {
            //android.provider.Settings;
            id = Settings.Secure.getString(context.getApplicationContext().getContentResolver(), Settings.Secure.ANDROID_ID);
        }
        return id;
    }

原理链接地址文章

相关文章

网友评论

      本文标题:Android 平板电脑的设备ID

      本文链接:https://www.haomeiwen.com/subject/aajuqxtx.html