Android无法在双卡手机中捕获奴隶SIM卡的手机信号ID和位置ID

时间:2014-07-16 13:07:55

标签: java android eclipse

我需要奴隶SIM卡的cell idlocation id;但它总是返回0并且我的主插槽sim不存在。我该如何正确使用它?顺便说一句,我已经正确检查SIM是否存在。

我的代码是:

final GsmCellLocation locationG = (GsmCellLocation) tel.getCellLocation();

    if (locationG != null)
    {
        cellId = locationG.getCid();
        lac = locationG.getLac();
        cellId = cellId & 0xffff;
    }

1 个答案:

答案 0 :(得分:-1)

//you need to check if 2G or 3G

lac = String.valueOf(finalLocation.getLac()); 
cellId = String.valueOf(finalLocation.getCid());

if(3G) { 
   cellId= String.valueOf( Integer.valueOf( cellId)& 0xffff); 
   lac= String.valueOf( Integer.valueOf( lac)& 0xffff);
}