简体   繁体   English

Android API位置

[英]Android API Location

My app can show network info such as MCC, MNC, LAC, CellID, RXlevel. 我的应用程序可以显示网络信息,例如MCC,MNC,LAC,CellID,RXlevel。 However I want to force my Android to connect to fix cellID or channel (frequency). 但是我想强迫我的Android连接以修复cellID或频道(频率)。 Do you know how to do it ? 你知道怎么做吗?

Thank you so much. 非常感谢。

Phong

If you're referring to determining the location of the cell tower your phone is communicating with, you can only do this via Android platform APIs with CDMA devices: http://developer.android.com/reference/android/telephony/cdma/CdmaCellLocation.html#getBaseStationLatitude () 如果要确定手机正在与之通信的手机信号塔的位置,则只能通过具有CDMA设备的Android平台API来执行此操作: http : //developer.android.com/reference/android/telephony/cdma/ CdmaCellLocation.html#getBaseStationLatitude ()

and

http://developer.android.com/reference/android/telephony/cdma/CdmaCellLocation.html#getBaseStationLongitude () http://developer.android.com/reference/android/telephony/cdma/CdmaCellLocation.html#getBaseStationLongitude ()

Be aware that sometimes these APIs will give you an estimate of the cell sector centroid instead of the physical location of the tower. 请注意,有时这些API会为您提供小区扇区形心的估计值,而不是塔的物理位置。

You can also use the Network location provider. 您也可以使用网络位置提供程序。

Register the provider: 注册提供商:

lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);

And listen for location via the LocationListener: 并通过LocationListener监听位置:

@Override
public void onLocationChanged(Location location) {
    Log.i(TAG, "New lat: " + location.getLatitude());
    Log.i(TAG, "New long: " + location.getLongitude());
}

but you will get both cell and WiFi-based location from this. 但您会从中同时获得基于蜂窝和基于WiFi的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM