其中,radio_type通过TelephonyManager.getNetworkType()获取;signal_strength在PhoneStateListener的回调方法onSignalStrengthChanged中可以得到,mobile_country_code:取telephonyManager.getSimOperator()的前3位数字。剩下的cell_id、location_area_code和mobile_network_code根据网络类型不同而不同:
GSM
cell_id: gsmCellLocation.getCid()
location_area_code:gsmCellLocation.getLac()
mobile_network_code:telephonyManager.getSimOperator()第4位以后的数字
CDMA
cell_id 用 BID值替换 cdmaCellLocation.getBaseStationId()
location_area_code 用NID值替换 cdmaCellLocation.getNetworkId()
mobile_network_code用SID值替换 cdmaCellLocation.getSystemId()
WIFI数据可以通过ScanResult获取:
mac_address: scanResult.BSSID
signal_strength: scanResult.level
ssid: scanResult.SSID
通过Android平台上的相关接口获取到这些数据之后可以用JSONString组织JSON串