2013-04-25 4 views
5

मुझे लगता है कि हमारे पास सीडीएमएसीएलएलोकेशन और जीएसएमसीएलएलोकेशन के लिए कक्षाएं हैं, लेकिन एलटीई के लिए कुछ भी विशिष्ट नहीं है। क्या मैं अपने टेलीफोनी सेवा संदर्भ के लिए विशिष्ट एलटीई सेल स्थान प्राप्त कर सकता हूं? धन्यवाद!एंड्रॉइड में एलटीई सेल स्थान कैसे प्राप्त करें?

+0

आप केवल एपीआई 17 –

+0

में एलटीई जानकारी प्राप्त कर सकते हैं उत्तर के लिए धन्यवाद! मैं एपीआई 17 पर हूं। मैं जानना चाहता था कि TelephonyManager के getAllCellInfo() फ़ंक्शन द्वारा लौटाई गई सरणीसूची से CellInfo को कैसे निकाला जाए। – user1985703

उत्तर

-1

आप) सूची getAllCellInfo (द्वारा वापस सूची के माध्यम से पुनरावृति और देखें कि क्या CellInfo एक CellInfoLte या

TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); 
List<CellInfo> cellInfoList = tm.getAllCellInfo(); 
for (CellInfo cellInfo : cellInfoList) 
{ 
    if (cellInfo instanceof CellInfoLte) 
    { 
     // cast to CellInfoLte and call all the CellInfoLte methods you need 
    } 
} 
+1

यह सवाल का जवाब नहीं देता है। एक बार आपके पास CellInfoLte ऑब्जेक्ट हो जाने पर, आपको स्थान जानकारी कैसे प्राप्त होती है? – DataDino

0

यहाँ सावधान रहो द्वारा नहीं है सकते हैं - हालांकि एपीआई सेल की जानकारी के लिए एक इंटरफेस प्रदान कर सकता है, यह वास्तव में वाहक पर निर्भर करता है। सीडीएमए के विपरीत जो अपने रैडियस आउटपुट के हिस्से के रूप में पाठ्यक्रम स्थान जानकारी प्रदान कर सकता है, एलटीई कार्यान्वयन के अनुसार बदलता है। एलटीई नेटवर्क के केवल "निचले" स्तरों को पता है कि आप कहां हो सकते हैं, और यह सबसे अच्छा है। अपने वाहक के बुनियादी ढांचे को जानने के बिना, उनके एमएमई कैसे काम करते हैं, आपको जानकारी मिल सकती है, लेकिन मुझे भू-स्थान की जानकारी के लिए भरोसा नहीं होगा।

इसके अलावा, यह आपके वाहक चुनावों के आधार पर निर्भर करता है। डिवाइस प्रोफाइल के आधार पर, आपको एक मिनट में एक बार मतदान किया जा सकता है, हर पांच मिनट में, हर दो घंटे में एक बार। यदि आप रोमिंग कर रहे हैं, तो आपको कचरे के अलावा कुछ भी नहीं मिल सकता है क्योंकि मूल्यों के लिए कोई अच्छा मानक नहीं है।

0

आप सेलइन्फो की सूची से संबंधित उदाहरणों पर एक विशिष्ट कलाकार के साथ एलटीई कनेक्शन से जानकारी ले सकते हैं।

MobileInfoRecognizer mobileInfoRecognizer = new MobileInfoRecognizer(); 
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); 
List<CellInfo> cellInfos = tm.getAllCellInfo(); 
additional_info = mobileInfoRecognizer.getCellInfo(cellInfos.get(0)); 

मेरे आवेदन में मैंने देखा कि आप अपनी सूची में केवल पहला तत्व ही ले सकते हैं;

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.getCi() + "\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; 
    } 
} 

तो, अगर परीक्षण के अंतर्गत उपकरण LTE का समर्थन नहीं करता, तो आप हमेशा अपने कनेक्शन के बारे में अन्य संबंधित जानकारी प्राप्त कर सकते हैं: मैं आप अपने कस्टम वर्ग दिखा। आशा है कि आप इसे उपयोगी पा सकते हैं।

संबंधित मुद्दे