Use JAVA code to obtain some basic information about the mobile phone (the local number, SDK version, system version, and mobile phone model) and javasdk

Source: Internet
Author: User

Use JAVA code to obtain some basic information about the mobile phone (the local number, SDK version, system version, and mobile phone model) and javasdk

The Code is as follows:

Package com. zzw. getPhoneInfos; import android. app. activity; import android. content. context; import android. OS. build; import android. OS. bundle; import android. telephony. telephonyManager; import android. util. log; public class MainActivity extends Activity {@ Override protected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); setContentView (R. layout. activity_main); // obtain the telephone management object TelephonyManager mTelephonyManager = (TelephonyManager) this. getSystemService (Context. TELEPHONY_SERVICE); // obtain the mobile phone number String phoneNumber = mTelephonyManager. getLine1Number (); Log. d ("Get local phone number --->", phoneNumber); // obtain the phone model String phoneModel = Build. MODEL; Log. d ("Get Mobile Phone model --->", phoneModel); // get the SDK version String phoneSdkVersion = Build. VERSION. SDK; Log. d ("Get SDK version --->", phoneSdkVersion); // obtain the system version String phoneReleaseVersion = Build. VERSION. RELEASE; Log. d ("Get mobile phone system version -->", phoneReleaseVersion );}}

Do not forget the permission:

<uses-permission android:name="android.permission.READ_PHONE_STATE" />

Result

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.