使用android三星galaxy智能手机获取邻近细胞信息

莫森·阿里(Mohsen Ali)

我的目标是获取所有相邻的基站信息,例如小区ID,小区lac和RSS值,我使用该类telephonyManager.getNeighboringCellInfo()来获取所需的信息,但每次都返回null。

但是,我成功地获得了使用可以连接到移动设备(即服务小区)的最接近的单小区信号塔信息telephonyManager.getCellLocation()

我试图解决此问题并搜索与之相关的所有事物,然后我们发现所有三星设备均不支持telephonyManager.getNeighboringCellInfo()class,它不适用于三星,但适用于HTC和LG设备。

看到这个:https : //code.google.com/p/android/issues/detail?id=24136

我需要将其应用在Samsung Android设备上并获取邻近单元的信息。谁能告诉我我该怎么做?

单单元格代码:

if (telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM) {
            cellLocation = (GsmCellLocation)telephonyManager.getCellLocation();
            if(cellLocation!=null){
                int cell_ID = cellLocation.getCid();
                int cell_psc= cellLocation.getPsc();
                int cell_lac =cellLocation.getLac();
                cell_info.setText("Cell_ID: "+ String.valueOf(cell_ID) +"\n"+"Cell_psc: "+ String.valueOf(cell_psc)+"\n"+
                        "Cell_lac: " +String.valueOf(cell_lac)+"\n"+cellLocation.toString());

            }
        }

相邻单元格代码:

List<NeighboringCellInfo> neighboringCellInfos = telephonyManager.getNeighboringCellInfo();
        for(NeighboringCellInfo neighboringCellInfo : neighboringCellInfos)
        {
            neighboringCellInfo.getCid();
            neighboringCellInfo.getLac();
            neighboringCellInfo.getPsc();
            neighboringCellInfo.getNetworkType();
            neighboringCellInfo.getRssi();

            neibouring_cell_information.add(neighboringCellInfo.getCid()+"\n"+ neighboringCellInfo.getRssi());

        }
        Toast.makeText(getApplicationContext(),neibouring_cell_information +"ok" , Toast.LENGTH_LONG).show();

所有添加的权限:

    <uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
艾曼·阿比(Ayman Al-Absi)

三星手机似乎不支持邻居显示。请检查此论坛:

http://www.finetopix.com/showthread.php?30787-G-NetTrack-Android-OS-Netmonitor/page2

该应用程序的开发人员表示,三星芯片不支持显示邻居的命令。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章