Android get phone manufacturer, model, Android system version number, IMEI, current system language and other tool classes

Source: Internet
Author: User

Recently in the development, need to use some system information, here I write these methods into a tool class to facilitate later reuse, the tool class has the following 6 functions:

1, access to mobile phone manufacturers

2. Get Phone model

3. Get the current language of the mobile system

4. Get the Android system version number

5. Get IMEI serial number of mobile phone

6. Get the list of languages in your phone

Systemutil class

[Java]View PlainCopy
  1. /**
  2. * System Tool Class
  3. * Created by Zhuwentao on 2016-07-18.
  4. */
  5. Public class Systemutil {
  6. /** 
  7. * Get the current phone system language.
  8. *
  9. * @return returns the current system language. For example: "Chinese-Chinese" is currently set, then return "ZH-CN"
  10. */
  11. public static String Getsystemlanguage () {
  12. return Locale.getdefault (). GetLanguage ();
  13. }
  14. /** 
  15. * Get a list of languages on the current system (locale list)
  16. *
  17. * @return Language List
  18. */
  19. public Static locale[] Getsystemlanguagelist () {
  20. return Locale.getavailablelocales ();
  21. }
  22. /** 
  23. * Get the current phone system version number
  24. *
  25. * @return System version number
  26. */
  27. public static String getsystemversion () {
  28. return Android.os.Build.VERSION.RELEASE;
  29. }
  30. /** 
  31. * Get phone model
  32. *
  33. * @return Phone model
  34. */
  35. public static String Getsystemmodel () {
  36. return Android.os.Build.MODEL;
  37. }
  38. /** 
  39. * Access to mobile phone manufacturers
  40. *
  41. * @return Handset Maker
  42. */
  43. public static String Getdevicebrand () {
  44. return Android.os.Build.BRAND;
  45. }
  46. /** 
  47. * Get phone IMEI (requires "Android.permission.READ_PHONE_STATE" permission)
  48. *
  49. * @return Phone IMEI
  50. */
  51. public static String Getimei (Context ctx) {
  52. Telephonymanager TM = (Telephonymanager) ctx.getsystemservice (Activity.telephony_service);
  53. if (tm! = null) {
  54. return Tm.getdeviceid ();
  55. }
  56. return null;
  57. }
  58. }


Where the acquisition of the phone IMEI needs to add permissions in Androidmanifest.xml:

[HTML]View PlainCopy
    1. <uses-permission android:name="Android.permission.READ_PHONE_STATE" />


Just call it right when you use these methods.

[Java]View PlainCopy
  1. Private void Showsystemparameter () {
  2. String TAG = "system parameter:";
  3. LOG.E (TAG, "handset maker:" + Systemutil.getdevicebrand ());
  4. LOG.E (TAG, "phone model:" + Systemutil.getsystemmodel ());
  5. LOG.E (TAG, "cell phone current system language:" + systemutil.getsystemlanguage ());
  6. LOG.E (TAG, "Android system version number:" + systemutil.getsystemversion ());
  7. LOG.E (TAG, "phone IMEI:" + Systemutil.getimei (Getapplicationcontext ()));
  8. }


return Result:

Android get phone manufacturer, model, Android system version number, IMEI, current system language and other tool classes

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.