This article shares the method of obtaining mobile phone system version and other information on Android for your reference. The specific content is as follows:
The first code:
String phoneInfo = "Product: " + ; phoneInfo += ", CPU_ABI: " + .CPU_ABI; phoneInfo += ", TAGS: " + ; phoneInfo += ", VERSION_CODES.BASE: " + .VERSION_CODES.BASE; phoneInfo += ", MODEL: " + ; phoneInfo += ", SDK: " + ; phoneInfo += ", : " + ; phoneInfo += ", DEVICE: " + ; phoneInfo += ", DISPLAY: " + ; phoneInfo += ", BRAND: " + ; phoneInfo += ", BOARD: " + ; phoneInfo += ", FINGERPRINT: " + ; phoneInfo += ", ID: " + ; phoneInfo += ", MANUFACTURER: " + ; phoneInfo += ", USER: " + ; TextView t = (TextView) findViewById(.main_phoneinfo); (phoneInfo);
The second code:
private String getHandSetInfo(){ String handSetInfo= “Mobile phone model:” + + “,SDKVersion:” + + “,系统Version:” + + “,软件Version:”+getAppVersionName(); return handSetInfo; } //Get the current version numberprivate String getAppVersionName(Context context) { String versionName = “”; try { PackageManager packageManager = (); PackageInfo packageInfo = (“”, 0); versionName = ; if ((versionName)) { return “”; } } catch (Exception e) { (); } return versionName; }
The third code:Obtain information such as mobile phone model, system version, App version number, etc., specific code:
MainActivity is as follows:
package ; import ; import ; import ; import ; import ; import ; import ; /** * Demo description: * Obtain information such as mobile phone model, system version, App version number, etc. */ public class MainActivity extends Activity { private TextView mTextView; @Override protected void onCreate(Bundle savedInstanceState) { (savedInstanceState); setContentView(); init(); } private void init(){ mTextView=(TextView) findViewById(); (getHandSetInfo()); } private String getHandSetInfo(){ String handSetInfo= "Mobile phone number:" + + ",SDK version:" + + ", System Version:" + + ",Software Version:"+getAppVersionName(); return handSetInfo; } //Get the current version numberprivate String getAppVersionName(Context context) { String versionName = ""; try { PackageManager packageManager = (); PackageInfo packageInfo = ("", 0); versionName = ; if ((versionName)) { return ""; } } catch (Exception e) { (); } return versionName; } }
as follows:
<RelativeLayout xmlns:andro xmlns:tools="/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android: android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" android:layout_centerInParent="true" /> </RelativeLayout>
The last piece of code:
phoneInfo = "Product: " + ; phoneInfo += ", CPU_ABI: " + .CPU_ABI; phoneInfo += ", TAGS: " + ; phoneInfo += ", VERSION_CODES.BASE: " + .VERSION_CODES.BASE; phoneInfo += ", MODEL: " + ; phoneInfo += ", SDK: " + ; phoneInfo += ", : " + ; phoneInfo += ", DEVICE: " + ; phoneInfo += ", DISPLAY: " + ; phoneInfo += ", BRAND: " + ; phoneInfo += ", BOARD: " + ; phoneInfo += ", FINGERPRINT: " + ; phoneInfo += ", ID: " + ; phoneInfo += ", MANUFACTURER: " + ; phoneInfo += ", USER: " + ;
The above is all the content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.