---原始碼---
import android.content.Context; import android.telephony.TelephonyManager; 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()];
沒有留言:
張貼留言