开发者

Get Cell Tower Locations - Android

开发者 https://www.devze.com 2023-03-20 06:17 出处:网络
Does anyone know if it is possible t开发者_Go百科o get information about all of the cell towers in range of a device? Just be able to get the location of them or maybe any other information about them

Does anyone know if it is possible t开发者_Go百科o get information about all of the cell towers in range of a device? Just be able to get the location of them or maybe any other information about them and how I would go about doing it?


This is how you get the cell tower id (CID) and the lac (Location Area Code) from your current network state:

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;
        }
    }
}

Getting Lat,Lng location information after that is a little trickier. Here's a link to a post that's about Symbian but talks about Cell Tower -> Lat,Lng conversion: http://discussion.forum.nokia.com/forum/showthread.php?s=&threadid=19693

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号