问题
I'm struggling a little trying to get neighbour cells info (for the current cell info, everything works fine):
mTelephMgr=(TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
neighbours=mTelephMgr.getNeighboringCellInfo();
I've tried with 2G/3G networks, with Galaxy S (2.2.1) & Nexus S (2.3.1), and two different carriers but I always get an empty list for neighbours. The networks are GSM based (Spain).
I've been googling for a while, and whereas some people are reporting the same issue, other seem to have the function working perfectly.
Any suggestions?
Many thanks in advance.
回答1:
This is not a phone brand issue, the reason is that using a 3G connection you can't get any neighboring cell info (returns an empty list). You need to switch to 2G to get it.
回答2:
Any ways, im not sure if that works. Because your code doesnt return a LIST. it has to be a list. This is what i have done:-
TelephonyManager teleManager = (TelephonyManager)getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
List<NeighboringCellInfo> neighborInfo = teleManager.getNeighboringCellInfo();
Log.e("xxxxx", "Size: " + neighborInfo.size() );
This works, because i have used it. But if anyone gets to know why is the List always empty, please do let me know
来源:https://stackoverflow.com/questions/5536705/getneighboringcellinfo-returning-null-list