本文介绍了getNeighboringCellInfo()返回空列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我挣扎有点想获得相邻小区的信息(当前小区信息,一切工作正常):

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();

我已经试过与2G / 3G网络,与银河S(2.2.1)及歌Nexus S(2.3.1),和两个不同的运营商,但我总是得到一个空列表的邻居。该网络基于GSM(西班牙)。

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).

我一直在Google上搜寻了一​​段时间,和而有些人报告了同样的问题,其他的似乎有功能正常使用。

I've been googling for a while, and whereas some people are reporting the same issue, other seem to have the function working perfectly.

有什么建议?

在预先感谢。

推荐答案

任何方式,即时通讯不知道是否可行。因为你的code犯规返回一个列表。它必须是一个列表。这是我做了什么: -

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

这篇关于getNeighboringCellInfo()返回空列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-28 02:46