移动联通电信获取基站数据库的方案.doc

上传人:F****n 文档编号:104984187 上传时间:2019-10-11 格式:DOC 页数:12 大小:89KB
返回 下载 相关 举报
移动联通电信获取基站数据库的方案.doc_第1页
第1页 / 共12页
移动联通电信获取基站数据库的方案.doc_第2页
第2页 / 共12页
移动联通电信获取基站数据库的方案.doc_第3页
第3页 / 共12页
移动联通电信获取基站数据库的方案.doc_第4页
第4页 / 共12页
移动联通电信获取基站数据库的方案.doc_第5页
第5页 / 共12页
点击查看更多>>
资源描述

《移动联通电信获取基站数据库的方案.doc》由会员分享,可在线阅读,更多相关《移动联通电信获取基站数据库的方案.doc(12页珍藏版)》请在金锄头文库上搜索。

1、移动联通电信获取基站数据库的方案在googleAPI里提供了基站信息的获取类TelephonyManager,通过其方法getCellLocation得到CellLocation即可获取到基站相关信息但CellLocation是个抽象类,所以在具体使用时需要判断接入的网络制式来用其子类CdmaCellLocation或GsmCellLocation来强转CdmaCellLocation对应CDMA网,GsmCellLocation对应GSM网三大网络运营商的网络制式对应如下:移动2G 网 - GSM移动3G 网 - TD-SCDMA电信2G 网 - CDMA电信3G 网 - CDMA2000联

2、通2G 网 - GSM联通3G 网 - WCDMA由此可见移动,联通2G 网都可使用GsmCellLocation电信2G,3G网则使用CdmaCellLocation那么移动3G和联通3G又当如何其实经本人亲测,移动3G网也可使用GsmCellLocation,听说是TD-SCDMA衍生于GSM,具体原因咱也不用纠结了,反正能用就是了而联通的WCDMA据说也可使用GsmCellLocation,那姑且就是这样吧,有条件的童鞋试一试吧。对于网络制式的判断调用TelephonyManager.getNetworkType()可有多种情况,如下: NETWORK_TYPE_UNKNOWN NETW

3、ORK_TYPE_GPRS NETWORK_TYPE_EDGE NETWORK_TYPE_UMTS NETWORK_TYPE_HSDPA NETWORK_TYPE_HSUPA NETWORK_TYPE_HSPA NETWORK_TYPE_CDMA NETWORK_TYPE_EVDO_0 NETWORK_TYPE_EVDO_A NETWORK_TYPE_EVDO_B NETWORK_TYPE_1xRTT NETWORK_TYPE_IDEN NETWORK_TYPE_LTE NETWORK_TYPE_EHRPD通过对网络类型判断后获取对应基站信息代码片段如下:Html代码1. publicstat

4、icArrayListgetCellIDInfo(Contextcontext)throwsException2. 3. TelephonyManagermanager=(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);4. 5. ArrayListCellID=newArrayList();6. CellIDInfocurrentCell=newCellIDInfo();7. 8. inttype=manager.getNetworkType();9. Log.d(TAG,getCellIDInfo-N

5、etworkType=+type);10. intphoneType=manager.getPhoneType();11. Log.d(TAG,getCellIDInfo-phoneType=+phoneType);12. 13. if(type=TelephonyManager.NETWORK_TYPE_GPRS/GSM网14. |type=TelephonyManager.NETWORK_TYPE_EDGE15. |type=TelephonyManager.NETWORK_TYPE_HSDPA)16. 17. GsmCellLocationgsm=(GsmCellLocation)man

6、ager.getCellLocation();18. if(gsm=null)19. 20. Log.e(TAG,GsmCellLocationisnull!);21. returnnull;22. 23. 24. 25. intlac=gsm.getLac();26. Stringmcc=manager.getNetworkOperator().substring(0,3);27. Stringmnc=manager.getNetworkOperator().substring(3,5);28. intcid=gsm.getCid();29. 30. currentCell.cellId=g

7、sm.getCid();31. currentCell.mobileCountryCode=mcc;32. currentCell.mobileNetworkCode=mnc;33. currentCell.locationAreaCode=lac;34. 35. currentCell.radioType=gsm;36. 37. CellID.add(currentCell);38. 39. /获得邻近基站信息40. Listlist=manager.getNeighboringCellInfo();41. intsize=list.size();42. for(inti=0;isize;i

8、+)43. 44. CellIDInfoinfo=newCellIDInfo();45. info.cellId=list.get(i).getCid();46. info.mobileCountryCode=mcc;47. info.mobileNetworkCode=mnc;48. info.locationAreaCode=lac;49. 50. CellID.add(info);51. 52. 53. elseif(type=TelephonyManager.NETWORK_TYPE_CDMA/电信cdma网54. |type=TelephonyManager.NETWORK_TYPE

9、_1xRTT55. |type=TelephonyManager.NETWORK_TYPE_EVDO_056. |type=TelephonyManager.NETWORK_TYPE_EVDO_A)57. 58. 59. CdmaCellLocationcdma=(CdmaCellLocation)manager.getCellLocation();60. if(cdma=null)61. 62. Log.e(TAG,CdmaCellLocationisnull!);63. returnnull;64. 65. 66. intlac=cdma.getNetworkId();67. String

10、mcc=manager.getNetworkOperator().substring(0,3);68. Stringmnc=String.valueOf(cdma.getSystemId();69. intcid=cdma.getBaseStationId();70. 71. currentCell.cellId=cid;72. currentCell.mobileCountryCode=mcc;73. currentCell.mobileNetworkCode=mnc;74. currentCell.locationAreaCode=lac;75. 76. currentCell.radioType=cdma;77. 78. CellID.add(currentCell);79. 80. /获得邻近基站信息81. Listlist=manager.getNeighboringCellInfo();82. intsize=list.size();83. for(inti=0;isize;i+)84. 85. CellIDInfoinfo=newCellIDInfo();86. info.cellId=list.get(i).g

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 教学/培训

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号