Android : NeighboringCellInfo

跟風遠走 提交于 2019-12-06 15:13:33

问题


NeighboringCellInfo() on Android API, I want to know this function return all neighbor cell? And one of result is current cell which our device connected?

Thanks so much.


回答1:


Yes, it should.

But I never found a device where it did. Please report back here if you find any GSM device with any Android OS Version that does report at least one neighboring cell. Thank you!

You should be able to use the following code to get them:

TelephonyManager tm = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
List<NeighboringCellInfo> neighbours = tm.getNeighboringCellInfo();

You need the following permission in your AndroidManidfest.xml:

<uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES"/>

Since I never saw any result in the list I do not know whether the currently connected cell is included. I would guess it is not.




回答2:


Yes.. As seen @ d.android.com ;)

Here you have even source to take a deeper look..

Cheers



来源:https://stackoverflow.com/questions/10715503/android-neighboringcellinfo

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