获取Cell Tower地点 - Android

时间:2011-07-12 17:17:39

标签: java android location

有谁知道是否有可能获得有关设备范围内所有手机信号塔的信息?能够获得它们的位置或者可能有关于它们的任何其他信息以及我将如何去做它?

1 个答案:

答案 0 :(得分:9)

这是从当前网络状态获取cell tower id(CID)和lac(Location Area Code)的方法:

mPhoneStateReceiver = new PhoneStateIntentReceiver(this, new ServiceStateHandler());
mPhoneStateReceiver.notifyServiceState(MY_NOTIFICATION_ID);
mPhoneStateReceiver.notifyPhoneCallState(MY_NOTIFICATION_ID);
mPhoneStateReceiver.notifySignalStrength(MY_NOTIFICATION_ID);
mPhoneStateReceiver.registerIntent();

private class ServiceStateHandler extends Handler {
    public void handleMessage(Message msg) {
        switch (msg.what) {
            case MY_NOTIFICATION_ID:
                ServiceState state = mPhoneStateReceiver.getServiceState();
                System.out.println(state.getCid());
                System.out.println(state.getLac());
                System.out.println(mPhoneStateReceiver.getSignalStrength());
                break;
        }
    }
}

在此之后获取Lat,Lng位置信息有点棘手。这是一个关于Symbian的帖子的链接,但是谈到Cell Tower - > Lat,Lng转换:http://discussion.forum.nokia.com/forum/showthread.php?s=&threadid=19693