android之获取手机号码、获取手机操作系统版本号
/**
* 获取手机操作系统版本号:
*/
public static int getAndroidSDKVersion() {
return Build.VERSION.SDK_INT;
}
/**
* 获取手机号码
*/
public static String getNativePhoneNumber(Context context) {
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
String nativePhoneNumber = telephonyManager.getLine1Number();
if (nativePhoneNumber == null) {
nativePhoneNumber = "";
}
return nativePhoneNumber;
}