getNeighboringCellInfo()返回null

时间:2014-04-28 07:15:17

标签: android gsm

我大部分代码都试图获取相邻单元格信息(对于当前的单元格信息,一切正常)

 List<NeighboringCellInfo> neighborCells = telMgr.getNeighboringCellInfo();
 if (neighborCells == null) {
     Log.d("cells", "Neighbor cells is null");
 } else {
     for (NeighboringCellInfo cell : neighborCells) {
         Log.d("cells", cell.getCid()+"-"+cell.getLac()+" "+(-113+cell.getRssi()*2)+"dB");

         String neighboringcell= cell.getCid()+"-"+cell.getLac()+" "+(-113+cell.getRssi()*2)+"dB";

         Toast.makeText(getApplicationContext(), neighboringcell, Toast.LENGTH_LONG).show();
         mNeighboringcell.setText(neighboringcell);
     }
 }

我已使用此代码并授予此权限

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

我测试了三星4.0和熔岩4.1

请给我解决方案

由于