有人知道如何在android中獲取GSM信息嗎?諸如BCCH(廣播控制信道)和BCIS(基站標識碼)之類的信息。我已經獲得了LAC(位置區號)和CID(小區ID)。我知道這是一個低級別的信息,但有人知道獲得這些信息?我很難研究,我對蜂窩網絡一無所知。請幫助謝謝:)Android中的GSM網絡信息
4
A
回答
3
這裏是功能,它給你的GSM網絡的完整信息。 只是情境呼叫從活動
private void getNWInfo(Context context) {
/**
* <uses-permission android:name="android.permission.READ_PHONE_STATE"
* /> <uses-permission
* android:name="android.permission.ACCESS_NETWORK_STATE"/>
*/
TelephonyManager telephonyManager = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
String networkOperator = telephonyManager.getNetworkOperator();
int mcc = 0, mnc = 0;
if (networkOperator != null) {
mcc = Integer.parseInt(networkOperator.substring(0, 3));
mnc = Integer.parseInt(networkOperator.substring(3));
}
String SimNumber = telephonyManager.getLine1Number();
String SimSerialNumber = telephonyManager.getSimSerialNumber();
String countryISO = telephonyManager.getSimCountryIso();
String operatorName = telephonyManager.getSimOperatorName();
String operator = telephonyManager.getSimOperator();
int simState = telephonyManager.getSimState();
String voicemailNumer = telephonyManager.getVoiceMailNumber();
String voicemailAlphaTag = telephonyManager.getVoiceMailAlphaTag();
// Getting connected network iso country code
String networkCountry = telephonyManager.getNetworkCountryIso();
// Getting the connected network operator ID
String networkOperatorId = telephonyManager.getNetworkOperator();
// Getting the connected network operator name
String networkName = telephonyManager.getNetworkOperatorName();
int networkType = telephonyManager.getNetworkType();
String network = "";
ConnectivityManager cm = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
try {
if (cm.getActiveNetworkInfo().getTypeName().equals("MOBILE"))
network = "Cell Network/3G";
else if (cm.getActiveNetworkInfo().getTypeName().equals("WIFI"))
network = "WiFi";
else
network = "N/A";
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
TextView textView = (TextView) findViewById(R.id.textView);
textView.setText("network :" + network +
"\n" + "countryISO : " + countryISO + "\n" + "operatorName : "
+ operatorName + "\n" + "operator : " + operator + "\n"
+ "simState :" + simState + "\n" + "Sim Serial Number : "
+ SimSerialNumber + "\n" + "Sim Number : " + SimNumber + "\n"
+ "Voice Mail Numer" + voicemailNumer + "\n"
+ "Voice Mail Alpha Tag" + voicemailAlphaTag + "\n"
+ "Sim State" + simState + "\n" + "Mobile Country Code MCC : "
+ mcc + "\n" + "Mobile Network Code MNC : " + mnc + "\n"
+ "Network Country : " + networkCountry + "\n"
+ "Network OperatorId : " + networkOperatorId + "\n"
+ "Network Name : " + networkName + "\n" + "Network Type : "
+ networkType);
}
你可以找到這個博客
http://khurramitdeveloper.blogspot.in/search?updated-max=2013-11-07T03:23:00-08:00&max-results=7
希望它會幫助你:)
2
請訪問here更多細節。它解釋說沒有API可用於獲取無線電信息。
0
你可以試試這個:
public static JSONArray getCellInfo(Context ctx){
TelephonyManager tel = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE);
JSONArray cellList = new JSONArray();
int phoneTypeInt = tel.getPhoneType();
String phoneType = "unknown";
if (phoneTypeInt == TelephonyManager.PHONE_TYPE_GSM)
phoneType = "gsm";
else if (phoneTypeInt == TelephonyManager.PHONE_TYPE_CDMA)
phoneType = "cdma";
//from Android M up must use getAllCellInfo
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
List<NeighboringCellInfo> neighCells = tel.getNeighboringCellInfo();
for (int i = 0; i < neighCells.size(); i++) {
try {
JSONObject cellObj = new JSONObject();
NeighboringCellInfo thisCell = neighCells.get(i);
cellObj.put("cellId", thisCell.getCid());
cellObj.put("lac", thisCell.getLac());
cellObj.put("rssi", thisCell.getRssi());
cellList.put(cellObj);
} catch (Exception e) {
}
}
} else {
List<CellInfo> infos = tel.getAllCellInfo();
for (int i = 0; i < infos.size(); ++i) {
try {
JSONObject cellObj = new JSONObject();
CellInfo info = infos.get(i);
if (info instanceof CellInfoGsm) {
CellSignalStrengthGsm gsm = ((CellInfoGsm) info).getCellSignalStrength();
CellIdentityGsm identityGsm = ((CellInfoGsm) info).getCellIdentity();
cellObj.put("cellId", identityGsm.getCid());
cellObj.put("lac", identityGsm.getLac());
cellObj.put("dbm", gsm.getDbm());
cellList.put(cellObj);
} else if (info instanceof CellInfoLte) {
CellSignalStrengthLte lte = ((CellInfoLte) info).getCellSignalStrength();
CellIdentityLte identityLte = ((CellInfoLte) info).getCellIdentity();
cellObj.put("cellId", identityLte.getCi());
cellObj.put("tac", identityLte.getTac());
cellObj.put("dbm", lte.getDbm());
cellList.put(cellObj);
}
} catch (Exception ex) {
}
}
}
return cellList;
}
相關問題
- 1. 檢索GSM網絡信息Android?
- 2. Gsm網絡參數android
- 3. Android中的GSM網絡參數?
- 4. Android:網絡信息測量
- 5. Firefox中的網絡信息?
- 6. 3G網絡的網絡詳細信息
- 7. 網絡信息android ip倒置問題
- 8. ANDROID:查詢網絡頻段信息
- 9. Android檢索當前網絡信息
- 10. 如何模擬GSM網絡
- 11. Windows網絡信息處理
- 12. 網絡拓撲信息
- 13. FreeBSD:網絡接口信息
- 14. 在短信息中嵌入GSM cellids
- 15. 卡桑德拉網絡信息中心
- 16. 從網絡流中提取信息
- 17. Android:通過短信發送網絡信息
- 18. 的Windows Phone 8的網絡信息
- 19. 在Android Studio 1.4.1中重置網絡監視器統計信息
- 20. 加密的聲音在Android平臺調用GSM網絡
- 21. Nexus 7上的網絡統計信息
- 22. 用於網絡信息的SQL查詢
- 23. 訪問網絡上的DOM信息
- 24. 獲取有關WiFi網絡的信息
- 25. 有關網絡發現API的信息
- 26. 獲取信息的數據從網絡
- 27. 工作人員的PHP網絡信息
- 28. 在Android中檢索GSM信號強度
- 29. Android網絡消息框架?
- 30. 如何通過GSM網絡中的MAP-ATI與HLR進行通信?
怎麼樣BCCH和BSIC?你有想法來檢索這些信息嗎? – GummyBear0014
請通過這個線程https://groups.google.com/forum/#!topic/android-platform/tVyNMnXtcEI – khurram
你和anchit有相同的答案。 :(請問網絡的低級別信息是不是真的可能檢索到? – GummyBear0014