android 擷取手機型號,本機電話號碼,SDK版本以及firmwarw版本號碼(即系統版本號碼)

來源:互聯網
上載者:User

標籤:android   style   blog   color   使用   strong   io   for   

Android開發平台中,可通過TelephonyManager 擷取本機號碼。

1 TelephonyManager phoneMgr=(TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);2 txtPhoneNumber.setText(phoneMgr.getLine1Number()); //txtPhoneNumber是一個EditText 用於顯示手機號

注:

根據Android的安全機制,在使用TelephonyManager時,必須在 AndroidManifest.xml中

添加<uses-permission android:name="READ_PHONE_STATE" /> 否則無法獲得系統的許可。

手機型號 Build.MODEL

String MODEL The end-user-visible name for the end product.

sdk版本 Build.VERSION.SDK

String SDK This constant is deprecated. Use SDK_INT to easily get this as an integer.

及frimware版本號碼(系統版本號碼) Build.VERSION.RELEASE

String RELEASE he user-visible version string.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.