使用手机信号塔位置的Andr​​oid [英] Android location using Cell Tower

查看:268
本文介绍了使用手机信号塔位置的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能检索使用手机信号塔我的位置?当GPS和Wifi是关闭的。

我知道我可以retrevive塔的CellID,但我怎么能映射它让我的当前位置的纬度和经度?

我不在乎,如果它是不准确的位置。

我已经发现了一些片段,但使用WiFi似乎。


解决方案

  TelephonyManager telephonyManager =(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
  GsmCellLocation cellLocation =(GsmCellLocation)telephonyManager.getCellLocation();  INT CELLID = cellLocation.getCid();
  INT celllac = cellLocation.getLac(); Log.d(CellLocation,cellLocation.toString());
 Log.d(GSM CELL ID,将String.valueOf(CELLID));
 Log.d(GSM位置code,将String.valueOf(celllac));

请确保您有这些权限在您的清单中。

 <使用许可权的android:NAME =android.permission.ACCESS_COARSE_LOCATION/>
<使用许可权的android:NAME =android.permission.ACCESS_FINE_LOCATION/>

如果你真的想实​​际位置使用HttpClient的或有点查询 http://www.google。 COM / GLM / MMAP 与CELLID和LAC。例如在此列出。的http://www.anddev.org/poor_mans_gps_-celltowerid-_location_area_$c$c_-lookup-t257.html

How can I retrieve my location using cell towers? when GPS and Wifi is off.

I know i can retrevive cellID of towers, but how can i map it to get Latitude and Longitude of my current location?

I don't care if it isn't accurate location.

I have found some snippets but seems using wifi.

解决方案

  TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
  GsmCellLocation cellLocation = (GsmCellLocation)telephonyManager.getCellLocation();

  int cellid= cellLocation.getCid();
  int celllac = cellLocation.getLac();

 Log.d("CellLocation", cellLocation.toString());
 Log.d("GSM CELL ID",  String.valueOf(cellid));
 Log.d("GSM Location Code", String.valueOf(celllac));

Make sure that you have those permissions in your manifest.

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

If you really want the real position use a httpclient or somewhat to query http://www.google.com/glm/mmap with your cellid and lac. Example is listed here. http://www.anddev.org/poor_mans_gps_-celltowerid-_location_area_code_-lookup-t257.html

这篇关于使用手机信号塔位置的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆