机器人:NeighboringCellInfo总是空的!?为什么? [英] android: NeighboringCellInfo always empty !? why?
问题描述
我试图获取有关相邻小区我的手机可以看到ATM信息。到现在为止还挺好。我这样做是这样的:
telManager =(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
// ...
ArrayList的< NeighboringCellInfo> neighboringCellList =(ArrayList的< NeighboringCellInfo>)telManager.getNeighboringCellInfo();
不幸的是,这份名单原来是空的所有时间。即使是在不同的地方。我住在柏林,所以我不认为这是因为实际上只是一个单元可用!
更新: 我的权限是这样的:
<使用-权限的Android:名称=android.permission.INTERNET对/>
<使用-权限的Android:名称=android.permission.CHANGE_NETWORK_STATE/>
<使用-权限的Android:名称=android.permission.ACCESS_WIFI_STATE/>
<使用-权限的Android:名称=android.permission.ACCESS_NETWORK_STATE/>
<使用-权限的Android:名称=android.permission.ACCESS_FINE_LOCATION/>
<使用-权限的Android:名称=android.permission.ACCESS_COARSE_LOCATION/>
<使用-权限的Android:名称=android.permission.ACCESS_COARSE_UPDATES/>
<使用-权限的Android:名称=android.permission.READ_PHONE_STATE/>
我已经看到了同样的问题,几个问题,但它似乎是他们没有得到一个很好的和决定性的解决方案。最常见的建议是,以确保您有正确的权限(我看你在你的问题做的),并有一些说,这仅适用于2G和3G没有
看看下面类似的问题。这可能会指出你在一些新的方向:
<一个href="http://stackoverflow.com/questions/5536705/getneighboringcellinfo-returning-null-list">getNeighboringCellInfo()返回null列表
<一个href="http://stackoverflow.com/questions/3868223/problem-with-neighboringcellinfo-cid-and-lac">Problem与NeighboringCellInfo,CID和LAC
在Android的i'm trying to get info about the neighboring cells my phone can "see" atm. so far so good. i do this like this:
telManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
//...
ArrayList<NeighboringCellInfo> neighboringCellList = (ArrayList<NeighboringCellInfo>) telManager.getNeighboringCellInfo();
unfortunately, this list turns out to be empty all the time. even in different places. i live in berlin, so i don't think it's because there is actually just the one cell available!
update: my permissions look like this:
<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" />
I've seen several questions on the same issue but it seems like none of them got a good and deterministic solution. The most common suggestion is to make sure you have the correct permission (which I see you do in your question) and there are some that say that this only works on 2G and not 3G.
Take a look at the following similar questions. It might point you in some new directions:
getNeighboringCellInfo() returning null list
Problem with NeighboringCellInfo, CID and LAC
Get neighboring cell in Android returns null
这篇关于机器人:NeighboringCellInfo总是空的!?为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!