Get app and install phone-related information: App version number, phone model, mobile phone brand, Android system version number

Source: Internet
Author: User

/**
* 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;
}

Get app and install phone info: App version number, phone model, phone brand, Android system version number

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.