/**
* 获取IMEI
* @return
*/
private String getIMEI() {
TelephonyManager tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
return tm.getDeviceId();
}
/**
* 获取手机号码
*/
private String getPhoneNum() {
TelephonyManager tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
return tm.getLine1Number();
}
/**
* 获取mac地址
* @return
*/
private String getMac() {
WifiManager wm = (WifiManager) getSystemService(Context.WIFI_SERVICE);
WifiInfo wi = wm.getConnectionInfo();
return wi.getMacAddress();
}
/**
* 获取app名字
* @return
*/
public String getApplicationName() {
PackageManager packageManager = null;
ApplicationInfo applicationInfo = null;
try {
packageManager = getApplicationContext().getPackageManager();
applicationInfo = packageManager.getApplicationInfo(
getPackageName(), 0);
} catch (PackageManager.NameNotFoundException e) {
applicationInfo = null;
}
String applicationName = (String) packageManager
.getApplicationLabel(applicationInfo);
return applicationName;
}
/**
* 获取版本号
*
* @return 当前应用的版本号
*/
public String getVersion() {
String version = null;
try {
PackageManager manager = this.getPackageManager();
PackageInfo info = manager.getPackageInfo(this.getPackageName(), 0);
version = info.versionName;
} catch (Exception e) {
e.printStackTrace();
// return this.getString(R.string.can_not_find_version_name);
}
return version;
}
//获取屏幕宽高
WindowManager windowManager = getWindowManager();
Display display = windowManager.getDefaultDisplay();
int screenWidth = screenWidth = display.getWidth();
int screenHeight = screenHeight = display.getHeight();
android 获取手机的号码,mac等部分参数
最新推荐文章于 2021-05-25 22:35:13 发布