当前位置: 首页>>代码示例>>Java>>正文


Java CdmaCellLocation类代码示例

本文整理汇总了Java中android.telephony.cdma.CdmaCellLocation的典型用法代码示例。如果您正苦于以下问题:Java CdmaCellLocation类的具体用法?Java CdmaCellLocation怎么用?Java CdmaCellLocation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CdmaCellLocation类属于android.telephony.cdma包,在下文中一共展示了CdmaCellLocation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getIpBaseStation

import android.telephony.cdma.CdmaCellLocation; //导入依赖的package包/类
public static String getIpBaseStation() {
    TelephonyManager telMgr = (TelephonyManager) FDApplication
            .getInstance().getSystemService(Context.TELEPHONY_SERVICE);
    int cid = 0;
    int lac = 0;
    try {
        if (telMgr != null) {
            GsmCellLocation gc = (GsmCellLocation) telMgr.getCellLocation();
            if (null == gc) {
                return "0_0";
            }
            cid = gc.getCid();
            lac = gc.getLac();
        }
    } catch (Exception e) {
        if (telMgr != null) {
            CdmaCellLocation location = (CdmaCellLocation) telMgr
                    .getCellLocation();
            if (null == location) {
                return "0_0";
            }
            lac = location.getNetworkId();
            cid = location.getBaseStationId();
            cid /= 16;
        }
    }
    return lac + "_" + cid;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:29,代码来源:StrUtils.java

示例2: cdmaCellLocationJSON

import android.telephony.cdma.CdmaCellLocation; //导入依赖的package包/类
/**
 * Parses data from PhoneStateListener.LISTEN_CELL_LOCATION.onCellLocationChanged
 * http://developer.android.com/reference/android/telephony/cdma/CdmaCellLocation.html
 * @param location CdmaCellLocation
 * @return JSON
 */
public static String cdmaCellLocationJSON(CdmaCellLocation location){

    final Calendar calendar = Calendar.getInstance();
    final JSONObject json = new JSONObject();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && location != null) {
        try {
            json.put("provider", CELLLOCATION_PROVIDER);
            json.put("type", CDMA);
            json.put("timestamp", calendar.getTimeInMillis());
            json.put("baseStationId", location.getBaseStationId()); // -1 if unknown
            json.put("networkId", location.getNetworkId()); // -1 if unknown
            json.put("systemId", location.getSystemId()); // -1 if unknown
            json.put("baseStationLatitude", CdmaCellLocation.convertQuartSecToDecDegrees(location.getBaseStationLatitude()));
            json.put("baseStationLongitude", CdmaCellLocation.convertQuartSecToDecDegrees(location.getBaseStationLongitude()));
        }
        catch(JSONException exc) {
            logJSONException(exc);
        }
    }

    return json.toString();
}
 
开发者ID:SUTFutureCoder,项目名称:localcloud_fe,代码行数:30,代码来源:JSONHelper.java

示例3: isCellLocationEqual

import android.telephony.cdma.CdmaCellLocation; //导入依赖的package包/类
private boolean isCellLocationEqual(CellLocation cl1, CellLocation cl2) {
    boolean result;
    if (cl1 instanceof GsmCellLocation && cl2 instanceof GsmCellLocation) {
        GsmCellLocation gsm1 = (GsmCellLocation) cl1;
        GsmCellLocation gsm2 = (GsmCellLocation) cl2;
        result = (gsm1.getCid() == gsm2.getCid()
                && gsm1.getLac() == gsm2.getLac()
                && gsm1.getPsc() == gsm2.getPsc());
        Log.d("isCellLocationEqual(): GSM equals = %s", result);
    } else if (cl1 instanceof CdmaCellLocation && cl2 instanceof CdmaCellLocation) {
        CdmaCellLocation cdma1 = (CdmaCellLocation) cl1;
        CdmaCellLocation cdma2 = (CdmaCellLocation) cl2;
        result = (cdma1.getBaseStationId() == cdma2.getBaseStationId()
                && cdma1.getNetworkId() == cdma2.getNetworkId()
                && cdma1.getSystemId() == cdma2.getSystemId());
        Log.d("isCellLocationEqual(): CDMA equal = %s", result);
    } else {
        // different types or nulls
        result = false;
        Log.d("isCellLocationEqual(): Different types or nulls");
    }
    return result;
}
 
开发者ID:zamojski,项目名称:TowerCollector,代码行数:24,代码来源:MeasurementUpdater.java

示例4: update

import android.telephony.cdma.CdmaCellLocation; //导入依赖的package包/类
public void update(Measurement m, CellLocation cellLocation, int mcc, int mnc, NetworkGroup networkType) {
    if (cellLocation instanceof GsmCellLocation) {
        GsmCellLocation gsmCellLocation = (GsmCellLocation) cellLocation;
        if (gsmCellLocation.getCid() <= 65535 && gsmCellLocation.getPsc() == NeighboringCellInfo.UNKNOWN_CID) {
            m.setGsmCellLocation(mcc, mnc, gsmCellLocation.getLac(), gsmCellLocation.getCid(), NetworkGroup.Gsm);
        } else {
            // fix invalid network types (unfortunately not possible to distinguish between UMTS and LTE)
            if (networkType == NetworkGroup.Gsm || networkType == NetworkGroup.Cdma)
                networkType = NetworkGroup.Unknown;
            int psc = gsmCellLocation.getPsc();
            if (psc == NeighboringCellInfo.UNKNOWN_CID || psc == Measurement.UNKNOWN_CID) {
                psc = Measurement.UNKNOWN_CID;
            } else if (psc >= 504) {
                // only UMTS networks support larger PSC
                networkType = NetworkGroup.Wcdma;
            }
            m.setGsmCellLocation(mcc, mnc, gsmCellLocation.getLac(), gsmCellLocation.getCid(), psc, networkType);
        }
    } else if (cellLocation instanceof CdmaCellLocation) {
        CdmaCellLocation cdmaCellLocation = (CdmaCellLocation) cellLocation;
        m.setCdmaCellLocation(cdmaCellLocation.getSystemId(), cdmaCellLocation.getNetworkId(), cdmaCellLocation.getBaseStationId());
    } else {
        throw new UnsupportedOperationException("Cell location type not supported `" + cellLocation.getClass().getName() + "`");
    }
}
 
开发者ID:zamojski,项目名称:TowerCollector,代码行数:26,代码来源:CellLocationConverter.java

示例5: fromCellLocation

import android.telephony.cdma.CdmaCellLocation; //导入依赖的package包/类
static CellLocationSingleData fromCellLocation(CellLocation location) {
    int cid, lac;
    if (location != null) {
        if (location instanceof GsmCellLocation) {
            cid = ((GsmCellLocation) location).getCid();
            lac = ((GsmCellLocation) location).getLac();
        }
        else if (location instanceof CdmaCellLocation) {
            cid = ((CdmaCellLocation) location).getBaseStationId();
            lac = ((CdmaCellLocation) location).getSystemId();
        } else {
            return null;
        }
        return new CellLocationSingleData(cid, lac);
    }
    return null;
}
 
开发者ID:renyuneyun,项目名称:Easer,代码行数:18,代码来源:CellLocationSingleData.java

示例6: next

import android.telephony.cdma.CdmaCellLocation; //导入依赖的package包/类
@Override
public TheDictionary next() {
	if (DEBUG) Log.d(TAG, "next:");
	TheDictionary map = new TheDictionary();
	try {
		if (i < 0) {
			if (cellLocation instanceof GsmCellLocation) {
				fill(map, ((GsmCellLocation) cellLocation));
			} else if (cellLocation instanceof CdmaCellLocation) {
				fill(map, ((CdmaCellLocation) cellLocation));
			} else {
				map.put("class", cellLocation.getClass().getName());
				map.put("string", cellLocation.toString());
			}
		} else {
			fill(map, neighboringCellInfoList.get(i));
		}
	}
	catch (Exception e) {
		throw new RuntimeException(e);
	}
	i++;
	if (DEBUG) Log.d(TAG, "next: map=" + map);
	return map;
}
 
开发者ID:emdete,项目名称:tabulae,代码行数:26,代码来源:CellIdPre17API.java

示例7: ay

import android.telephony.cdma.CdmaCellLocation; //导入依赖的package包/类
ay(CellLocation celllocation)
{
    a = 0x7fffffff;
    b = 0x7fffffff;
    c = 0x7fffffff;
    d = 0x7fffffff;
    e = 0x7fffffff;
    if (celllocation != null)
    {
        if (celllocation instanceof GsmCellLocation)
        {
            GsmCellLocation gsmcelllocation = (GsmCellLocation)celllocation;
            e = gsmcelllocation.getCid();
            d = gsmcelllocation.getLac();
        } else
        if (celllocation instanceof CdmaCellLocation)
        {
            CdmaCellLocation cdmacelllocation = (CdmaCellLocation)celllocation;
            c = cdmacelllocation.getBaseStationId();
            b = cdmacelllocation.getNetworkId();
            a = cdmacelllocation.getSystemId();
            return;
        }
    }
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:26,代码来源:ay.java

示例8: getData

import android.telephony.cdma.CdmaCellLocation; //导入依赖的package包/类
private Bundle getData() {
	TelephonyManager manager = (TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE);
	CellLocation location = manager.getCellLocation();
	Bundle data = new Bundle();
	if (location instanceof GsmCellLocation) {
		GsmCellLocation gsmLocation = (GsmCellLocation) location;
		gsmLocation.fillInNotifierBundle(data);
		data.putInt(TYPE, TelephonyManager.PHONE_TYPE_GSM);
	} else if (location instanceof CdmaCellLocation) {
		CdmaCellLocation cdmaLocation = (CdmaCellLocation) location;
		cdmaLocation.fillInNotifierBundle(data);
		data.putInt(TYPE, TelephonyManager.PHONE_TYPE_CDMA);
	} else {
		data.putInt(TYPE, TelephonyManager.PHONE_TYPE_NONE);
	}
	return data;
}
 
开发者ID:OpenSensing,项目名称:funf-v4,代码行数:18,代码来源:CellTowerProbe.java

示例9: getTowerValues

import android.telephony.cdma.CdmaCellLocation; //导入依赖的package包/类
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 };
}
 
开发者ID:KennethEvans,项目名称:Misc,代码行数:33,代码来源:MapLocationActivity.java

示例10: getGSMInfo

import android.telephony.cdma.CdmaCellLocation; //导入依赖的package包/类
public static GSMInfo getGSMInfo(Context context) {
    try {
        GSMInfo info = new GSMInfo();
        TelephonyManager manager = (TelephonyManager) context.getSystemService("phone");
        if (manager != null) {
            CellLocation cellLocation = manager.getCellLocation();
            int lac = 0;
            int cellid = 0;
            if (cellLocation != null) {
                if (cellLocation instanceof GsmCellLocation) {
                    lac = ((GsmCellLocation) cellLocation).getLac();
                    cellid = ((GsmCellLocation) cellLocation).getCid();
                } else if (cellLocation instanceof CdmaCellLocation) {
                    cellid = ((CdmaCellLocation) cellLocation).getNetworkId();
                    lac = ((CdmaCellLocation) cellLocation).getBaseStationId();
                }
            }
            info.lac = lac;
            info.cid = cellid;
        }
        AMapLocation location = AMapLocationTool.getInstance().location();
        if (location != null) {
            info.latitude = location.getLatitude();
            info.longitude = location.getLongitude();
            return info;
        }
        info.latitude = Double.parseDouble(PreferencesManager.getInstance().getLocationLongitude());
        info.longitude = Double.parseDouble(PreferencesManager.getInstance().getLocationLatitude());
        return info;
    } catch (Exception e) {
        LogInfo.log("ZSM++ ==== GSM exception e == " + e.getMessage());
        e.printStackTrace();
        return null;
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:36,代码来源:LetvUtils.java

示例11: type

import android.telephony.cdma.CdmaCellLocation; //导入依赖的package包/类
public static SubjectFactory<CdmaCellLocationSubject, CdmaCellLocation> type() {
  return new SubjectFactory<CdmaCellLocationSubject, CdmaCellLocation>() {
    @Override
    public CdmaCellLocationSubject getSubject(FailureStrategy fs, CdmaCellLocation that) {
      return new CdmaCellLocationSubject(fs, that);
    }
  };
}
 
开发者ID:pkware,项目名称:truth-android,代码行数:9,代码来源:CdmaCellLocationSubject.java

示例12: getCurrentLocation

import android.telephony.cdma.CdmaCellLocation; //导入依赖的package包/类
public static void getCurrentLocation(Context context) {
    TelephonyManager mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

    // 返回值MCC + MNC
    String operator = mTelephonyManager.getNetworkOperator();
    int mcc = Integer.parseInt(operator.substring(0, 3));
    int mnc = Integer.parseInt(operator.substring(3));
    Log.i(TAG, " MCC = " + mcc + "\t MNC = " + mnc + "\t");
    // 中国移动和中国联通获取LAC、CID的方式
    GsmCellLocation location = (GsmCellLocation) mTelephonyManager.getCellLocation();
    int lac = location.getLac();
    int cellId = location.getCid();



    // 中国电信获取LAC、CID的方式
    CdmaCellLocation location1 = (CdmaCellLocation) mTelephonyManager.getCellLocation();
    lac = location1.getNetworkId();
    cellId = location1.getBaseStationId();
    cellId /= 16;

    Log.i(TAG, " MCC = " + mcc + "\t MNC = " + mnc + "\t LAC = " + lac + "\t CID = " + cellId);
    // 获取邻区基站信息
    List<NeighboringCellInfo> infos = mTelephonyManager.getNeighboringCellInfo();
    StringBuffer sb = new StringBuffer("总数 : " + infos.size() + "\n");
    for (NeighboringCellInfo info1 : infos) { // 根据邻区总数进行循环
        sb.append(" LAC : " + info1.getLac()); // 取出当前邻区的LAC
        sb.append(" CID : " + info1.getCid()); // 取出当前邻区的CID
        sb.append(" BSSS : " + (-113 + 2 * info1.getRssi()) + "\n"); // 获取邻区基站信号强度
    }

    Log.i(TAG, " 获取邻区基站信息:" + sb.toString());
}
 
开发者ID:GOutPlay,项目名称:LBS,代码行数:34,代码来源:GSMCellLocationLbs.java

示例13: isValid

import android.telephony.cdma.CdmaCellLocation; //导入依赖的package包/类
public boolean isValid(CdmaCellLocation cell) {
    boolean valid = (isBidInRange(cell.getBaseStationId()) && isNidInRange(cell.getNetworkId())
            && isSidInRange(cell.getSystemId()));
    if (!valid) {
        Log.w("isValid(): Invalid CdmaCellLocation [sid=%s, nid=%s, bid=%s]", cell.getSystemId(), cell.getNetworkId(), cell.getBaseStationId());
        Log.w("isValid(): Invalid CdmaCellLocation %s", cell);
    }
    return valid;
}
 
开发者ID:zamojski,项目名称:TowerCollector,代码行数:10,代码来源:CdmaCellLocationValidator.java

示例14: isValid

import android.telephony.cdma.CdmaCellLocation; //导入依赖的package包/类
public boolean isValid(CellLocation cellLocation, int mcc, int mnc) {
    if (cellLocation instanceof GsmCellLocation) {
        GsmCellLocation gsmCellLocation = (GsmCellLocation) cellLocation;
        return getGsmValidator().isValid(gsmCellLocation, mcc, mnc);
    }
    if (cellLocation instanceof CdmaCellLocation) {
        CdmaCellLocation cdmaCellLocation = (CdmaCellLocation) cellLocation;
        return getCdmaValidator().isValid(cdmaCellLocation);
    }
    throw new UnsupportedOperationException("Cell location type not supported `" + cellLocation.getClass().getName() + "`");
}
 
开发者ID:zamojski,项目名称:TowerCollector,代码行数:12,代码来源:CellLocationValidator.java

示例15: onCellLocationChanged

import android.telephony.cdma.CdmaCellLocation; //导入依赖的package包/类
@Override
public void onCellLocationChanged(CellLocation location) {
    super.onCellLocationChanged(location);
    //Log.e(Tag,"onCellLocationChanged");
    if (location instanceof CdmaCellLocation) {
        cdma_SID = ((CdmaCellLocation) location).getSystemId();
        cdma_NID = ((CdmaCellLocation) location).getNetworkId();
        cdma_BSID = ((CdmaCellLocation) location).getBaseStationId();
        //Log.e(Tag,((CdmaCellLocation)location).toString());
    }
    ((MainActivity)mcontext).mSectionsPagerAdapter.notifyDataSetChanged();
}
 
开发者ID:hugecheng,项目名称:CellularSignal,代码行数:13,代码来源:RadioInfo.java


注:本文中的android.telephony.cdma.CdmaCellLocation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。