Old style, I won’t say much nonsense, I will just post java code to everyone.
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); // Get the phone management object TelephonyManager mTelephonyManager = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE); // Get the mobile phone number String phoneNumber = mTelephonyManager.getLine1Number(); Log.d("Get the native phone number --->", phoneNumber); // Get the mobile phone model String phoneModel = Build.MODEL; Log.d("Get the mobile phone model --->", phoneModel); // Get the mobile phone model String phoneModel = Build.MODEL; Log.d("Get the mobile phone model --->", phoneModel); // Get the mobile phone model String phoneModel = Build.MODEL; Log.d("Get the mobile phone model --->", phoneModel); // Get the mobile phone model String phoneModel = Build.MODEL; Log.d("Get the mobile phone model --->", phoneModel); // Get the mobile phone model String phoneModel = Build.MODEL; Log.d("Get the mobile phone model --->", phoneModel); // Get the mobile phone model String phoneModel = Build.MODEL; Log.d("Get the mobile phone model --->", phoneModel); // Get the mobile phone model String phoneModel = Build.MODEL; Get the SDK version String phoneSdkVersion = Build.VERSION.SDK; Log.d("Get SDK version--->", phoneSdkVersion); // Get the system version String phoneReleaseVersion = Build.VERSION.RELEASE; Log.d("Get mobile phone system version-->", phoneReleaseVersion); }} Don't forget permissions:
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
The results are shown in the figure:
Java android to get information about mobile operating system
String phoneInfo = "Product: " + android.os.Build.PRODUCT; phoneInfo += ", CPU_ABI: " + android.os.Build.CPU_ABI; phoneInfo += ", TAGS: " + android.os.Build.TAGS; phoneInfo += ", VERSION_CODES.BASE: " + android.os.Build.VERSION_CODES.BASE; phoneInfo += ", MODEL: " + android.os.Build.MODEL; phoneInfo += ", SDK: " + android.os.Build.VERSION.SDK; phoneInfo += ", VERSION.RELEASE: " + android.os.Build.VERSION.RELEASE; phoneInfo += ", DEVICE: " + android.os.Build.DEVICE; phoneInfo += ", DISPLAY: " + android.os.Build.DISPLAY; phoneInfo += ", BRAND: " + android.os.Build.BRAND; phoneInfo += ", BOARD: " + android.os.Build.BOARD; phoneInfo += ", FINGERPRINT: " + android.os.Build.FINGERPRINT; phoneInfo += ", ID: " + android.os.Build.ID; phoneInfo += ", MANUFACTURER: " + android.os.Build.MANUFACTURER; phoneInfo += ", USER: " + android.os.Build.USER; // Toast.makeText(this, phoneInfo, Toast.LENGTH_LONG).show(); TextView t = (TextView) findViewById(R.id.main_phoneinfo); t.setText(phoneInfo);