Android可以透過TelephonyManager來取得電信資訊
1.首先需要先在AndroidManifest.xml中開放權限
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
2.利用TelephonyManager取得資訊
//以下為片段程式碼 text = (TextView) findViewById( R.id.test ); //取得Context.TELEPHONY_SERVICE TelephonyManager telManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); //手機號碼 String lineNumber = telManager.getLine1Number(); //手機 IMEI String imei = telManager.getDeviceId(); //手機 IMSI String imsi = telManager.getSubscriberId(); //手機漫遊狀態 String roamingStatus = telManager.isNetworkRoaming() ? "漫遊中" : "非漫遊"; //電信網路國別 String country = telManager.getNetworkCountryIso(); //電信公司代號 String operator = telManager.getNetworkOperator(); //電信公司名稱 String operatorName = telManager.getNetworkOperatorName(); //行動網路類型 String[] networkTypeArray = {"UNKNOWN", "GPRS", "EDGE", "UMTS", "CDMA", "EVDO 0", "EVDO A", "1xRTT", "HSDPA", "HSUPA", "HSPA"}; String networkType = networkTypeArray[telManager.getNetworkType()]; //行動通訊類型 String[] phoneTypeArray = {"NONE", "GSM", "CDMA"}; String phoneType = phoneTypeArray[telManager.getPhoneType()]; text.setText("手機號碼:" + lineNumber + "\n" + "手機 IMEI:" + imei + "\n" + "手機 IMSI:" + imsi + "\n" + "手機漫遊狀態:" + roamingStatus + "\n" + "電信網路國別:" + country + "\n" + "電信公司代號:" + operator + "\n" + "電信公司名稱:" + operatorName + "\n" + "行動網路類型:" + networkType + "\n" + "行動通訊類型:" + phoneType + "\n" );