我正在为 CDMA 手机开发一个 Android 应用程序,它将收集它们所连接的手机信号塔的纬度/经度。
首先:这可能吗?
第二:我看过之前的 posts它说只需添加“CellLocation.requestLocationUpdate();”但它没有任何效果。这是我尝试检索位置的代码部分...
CdmaCellLocation CdmaLocation = (CdmaCellLocation)telephonyManager.getCellLocation();
int Longitude = CdmaLocation.getBaseStationLongitude();
int Latitude = CdmaLocation.getBaseStationLatitude();
查看the code对于 CdmaCellLocation 类显示这些值默认为 Integer.MAX_VALUE,但是您实际上如何设置纬度和经度?
最佳答案
您必须将 PhoneStateListener
与 LISTEN_CELL_LOCATION
以及相应的回调函数 onCellLocationChanged(CellLocation)
和 LISTEN_CELL_INFO
一起使用回调函数 onCellInfoChanged(List)
和可能的 LISTEN_SIGNAL_STRENGHTS
回调函数 onSignalStrengthsChanged(Signal Strength)
要停止从 PhoneStateListener 获取更改通知,请使用 LISTEN_NONE
http://www.truiton.com/2014/08/android-phonestatelistener-example/
https://developer.android.com/reference/android/telephony/PhoneStateListener.html
关于java - 使用 getBase Station Latitude()/Longitude() 的 CDMA android 手机的基站位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16641236/