获取应用和安装手机相关信息:应用版本号,手机型号,手机品牌,Android系统版本号

/**
* User-Agent

* @return user-agent
*/
public String getUser_Agent() {
String ua = "Android;" + getOSVersion() + ";" + getVersion() + ";"
+ getVendor() + "-" + getDevice();

return ua;
}

/**
* device model name, e.g: GT-I9100

* @return the user_Agent
*/
public String getDevice() {
return Build.MODEL;
}


/**
* device factory name, e.g: Samsung

* @return the vENDOR
*/
public String getVendor() {
return Build.BRAND;
}


/**
* @return the SDK version
*/
public int getSDKVersion() {
return Build.VERSION.SDK_INT;
}


/**
* @return the OS version
*/
public String getOSVersion() {
return Build.VERSION.RELEASE;
}



/**
* Retrieves application's version number from the manifest

* @return versionName
*/
public String getVersion() {
String version = "0.0.0";
try {
PackageInfo packageInfo = getPackageManager().getPackageInfo(
getPackageName(), 0);
version = packageInfo.versionName;
} catch (NameNotFoundException e) {
e.printStackTrace();
}


return version;
}

你可能感兴趣的:(获取应用和安装手机相关信息:应用版本号,手机型号,手机品牌,Android系统版本号)