It was written by reference to others' articles before it was very early. Record here.
Public int cellid; // the base station number Public String mobilecountrycode; // The China Mobile country code is 460 public string mobilenetworkcode; // The China Mobile Network number moves 0, China Unicom 1, china Telecom 2 Public int locationareacode; // location region code Public String radiotype; // network standard public int RSSI; // base station signal strength static networkinfo smnetworkinfo = NULL; public static networkinfo getnetworkinfo () {If (smnetworkinfo = NULL) {smnetworkinfo = new networkinfo ();} return smnetworkinfo;} public void ca Ncel () {If (smnetworkinfo! = NULL) {smnetworkinfo = NULL;} public void upload () {log. D ("network info ", cellid + "--" + mobilecountrycode + "--" + mobilenetworkcode + "--" + locationareacode + "--" + radiotype + "--" + Arg);} public void getnetworkinfo () {// todo auto-generated method stubarraylist <networkinfo> Infos = new arraylist <networkinfo> (); telephonymanager mtelephonymanager = (telephonymanager) gpsapplication. getappcontext (). getsystemservice (context. telephony_service); networkinfo currentinfo = new networkinfo (); int type = mtelephonymanager. getnetworktype (); // gsmif (type = telephonymanager. network_type_gprs | type = telephonymanager. network_type_edge | type = telephonymanager. network_type_hsdpa) {log. D ("networkinfo", "GSM location"); gsmcelllocation = (gsmcelllocation) mtelephonymanager. getcelllocation (); If (gsmcelllocation = NULL) {return;} int LAC = gsmcelllocation. getlac (); string MCC = mtelephonymanager. getnetworkoperator (). substring (0, 3); string MNC = mtelephonymanager. getnetworkoperator (). substring (3, 5); currentinfo. cellid = gsmcelllocation. getcid (); currentinfo. mobilecountrycode = MCC; currentinfo. export enetworkcode = MNC; currentinfo. locationareacode = LAC; currentinfo. radiotype = "GSM"; Infos. add (currentinfo); // obtain the base station information list <neighboringcellinfo> List = mtelephonymanager. getneighboringcellinfo (); For (INT I = 0; I <list. size (); I ++) {networkinfo info = new networkinfo (); info. cellid = List. get (I ). getcid (); info. mobilecountrycode = MCC; info. mobilenetworkcode = MNC; info. locationareacode = LAC; info. radiotype = "GSM"; info. http: // service.ap-southeast-1.maxcompute.aliyun-inc.com/api. get (I ). getarg (); Infos. add (Info) ;}/// Telecom CDMA else if (type = telephonymanager. network_type_cdma | type = telephonymanager. network_type_1xrtt | type = telephonymanager. network_type_evdo_0 | type = telephonymanager. network_type_evdo_a) {cdmacelllocation CDMA = (cdmacelllocation) mtelephonymanager. getcelllocation (); int LAC = CDMA. getnetworkid (); string MCC = mtelephonymanager. getnetworkoperator (). substring (0, 3); string MNC = string. valueof (CDMA. getsystemid (); int cid = CDMA. getbasestationid (); currentinfo. cellid = CID; currentinfo. mobilecountrycode = MCC; currentinfo. export enetworkcode = MNC; currentinfo. locationareacode = LAC; currentinfo. radiotype = "CDMA"; Infos. add (currentinfo); // obtain the information list of neighboring base stations <neighboringcellinfo> List = mtelephonymanager. getneighboringcellinfo (); int size = List. size (); For (INT I = 0; I <size; I ++) {networkinfo info = new networkinfo (); info. cellid = List. get (I ). getcid (); info. mobilecountrycode = MCC; info. mobilenetworkcode = MNC; info. locationareacode = LAC; info. http: // service.ap-southeast-1.maxcompute.aliyun-inc.com/api. get (I ). getarg (); Infos. add (Info) ;}}for (INT I = 0; I <Infos. size (); I ++) {Infos. get (I ). upload ();}}