MapLocationActivity.java 文件源码

java
阅读 22 收藏 0 点赞 0 评论 0

项目:Misc 作者:
private int[] getTowerValues() {
    // Find new values
    TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
    // Find the location
    if (tm == null) {
        popupMsg("Could not get TelephonyManager");
        return null;
    }
    int phoneType = tm.getPhoneType();
    if (phoneType != TelephonyManager.PHONE_TYPE_CDMA) {
        popupMsg("Only CDMA is supported");
        return null;
    }
    CellLocation cl = tm.getCellLocation();
    if (cl == null) {
        popupMsg("Could not get Cell Location");
        return null;
    }
    if (!(cl instanceof CdmaCellLocation)) {
        popupMsg("Cell Location is is not a CdmaCellLocation class");
        return null;
    }
    CdmaCellLocation cdmacl = (CdmaCellLocation) cl;
    int lat = NetworkActivity.locToGoogle(cdmacl.getBaseStationLatitude());
    int lon = NetworkActivity.locToGoogle(cdmacl.getBaseStationLongitude());
    int nid = cdmacl.getNetworkId();
    int sid = cdmacl.getSystemId();
    int bid = cdmacl.getBaseStationId();
    Log.d(TAG, "  New values: " + " lat=" + lat + " lon=" + lon + " nid="
            + nid + " sid=" + sid + " bid=" + bid);
    return new int[] { lat, lon, nid, sid, bid };
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号