2017-06-08 8 views
0

j'utilise GsmCellLocation pour obtenir LAC et id cellule pour le réseau 3G avec le code ci-dessous:
mcid = gmsCellLocation.getCid() & 0xffff;
mLac = gmsCellLocation.getLac();
et existe-t-il une bibliothèque ou une formule comment obtenir/calculer le LAC correct et l'id de cellule pour le réseau LTE (4G)? Merci.Comment obtenir LAC et id cellulaire LTE réseau

Répondre

0

J'espère que cela pourrait vous aider:

public class MobileInfoRecognizer { 

    public String getCellInfo(CellInfo cellInfo) { 
      String additional_info; 
      if (cellInfo instanceof CellInfoGsm) { 
       CellInfoGsm cellInfoGsm = (CellInfoGsm) cellInfo; 
       CellIdentityGsm cellIdentityGsm = cellInfoGsm.getCellIdentity(); 
       additional_info = "cell identity " + cellIdentityGsm.getCid() + "\n" 
         + "Mobile country code " + cellIdentityGsm.getMcc() + "\n" 
         + "Mobile network code " + cellIdentityGsm.getMnc() + "\n" 
         + "local area " + cellIdentityGsm.getLac() + "\n"; 
      } else if (cellInfo instanceof CellInfoLte) { 
       CellInfoLte cellInfoLte = (CellInfoLte) cellInfo; 
       CellIdentityLte cellIdentityLte = cellInfoLte.getCellIdentity(); 
       additional_info = "cell identity " + cellIdentityLte.getCid() + "\n" 
         + "Mobile country code " + cellIdentityLte.getMcc() + "\n" 
         + "Mobile network code " + cellIdentityLte.getMnc() + "\n" 
         + "physical cell " + cellIdentityLte.getPci() + "\n" 
         + "Tracking area code " + cellIdentityLte.getTac() + "\n"; 
      } else if (cellInfo instanceof CellInfoWcdma){ 
       CellInfoWcdma cellInfoWcdma = (CellInfoWcdma) cellInfo; 
       CellIdentityWcdma cellIdentityWcdma = cellInfoWcdma.getCellIdentity(); 
       additional_info = "cell identity " + cellIdentityWcdma.getCid() + "\n" 
         + "Mobile country code " + cellIdentityWcdma.getMcc() + "\n" 
         + "Mobile network code " + cellIdentityWcdma.getMnc() + "\n" 
         + "local area " + cellIdentityWcdma.getLac() + "\n"; 
      } 
      return additional_info; 
    } 
}