开发者

getNeighboringCellInfo() returning null list

开发者 https://www.devze.com 2023-02-22 01:35 出处:网络
I\'m struggling a little trying to get neighbour cells info (for the current cell info, everything works fine):

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 开发者_StackOverflow社区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.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消