package com.example.getuuid;
import android.content.Context;
import android.os.Build;
import android.provider.Settings;
import android.util.Log;
public class GetAndroidphoneId {
public static String GetSerial(Context context) {
String serial = "";
try {
serial = Settings.System.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
return serial;
} catch (Exception exception) {
//Log.d("TAG", "GetSerial: " + exception);
//serial需要一个初始化
serial = "NoGetid"; // 随便一个初始化
return serial;
}
}
}
- 1
- 2
- 3
- 4
- 5
- 6
前往页