getNeighboringCellInfo() returning null list

ぃ、小莉子 提交于 2019-12-01 17:08:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!