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


Java CellLocation类代码示例

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


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

示例1: e

import android.telephony.CellLocation; //导入依赖的package包/类
public final void e() {
    if (this.p == 1) {
        CellLocation.requestLocationUpdate();
        this.p = 2;
        this.l.sendEmptyMessage(1);
        if (this.s.b().isWifiEnabled()) {
            this.s.b().startScan();
            this.r = false;
        } else if (this.e) {
            this.o = System.currentTimeMillis();
            if (c && this.s.b().setWifiEnabled(true)) {
                this.r = true;
            } else {
                this.l.sendEmptyMessageDelayed(5, 8000);
            }
        } else {
            this.l.sendEmptyMessageDelayed(5, 0);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:21,代码来源:d.java

示例2: setLastCellLocation

import android.telephony.CellLocation; //导入依赖的package包/类
public synchronized void setLastCellLocation(CellLocation cellLocation, NetworkGroup networkType,
                                             String operatorCode, String operatorName, List<NeighboringCellInfo> neighboringCells) {
    Log.d("setLastCellLocation(): Cell location updated: %s, network type: %s, operator code: %s, operator name: %s", cellLocation, networkType, operatorCode, operatorName);
    // check if any changes
    boolean cellChanged = (!isCellLocationEqual(lastCellLocation, cellLocation)
            || lastNetworkType != networkType
            || !lastOperatorCode.equals(operatorCode)
            || !lastOperatorName.equals(operatorName));
    // update last cell
    this.lastCellLocation = cellLocation;
    this.lastNetworkType = networkType;
    this.lastOperatorCode = operatorCode;
    this.lastOperatorName = operatorName;
    this.neighboringCells = neighboringCells;
    if (this.neighboringCells == null) {
        this.neighboringCells = EMPTY_NEIGHBORING_CELL_LIST;
    }
    if (cellChanged) {
        notifyIfReadyToProcess();
    }
}
 
开发者ID:zamojski,项目名称:TowerCollector,代码行数:22,代码来源:MeasurementUpdater.java

示例3: isCellLocationEqual

import android.telephony.CellLocation; //导入依赖的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.CellLocation; //导入依赖的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.CellLocation; //导入依赖的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: onCellLocationChanged

import android.telephony.CellLocation; //导入依赖的package包/类
/**
 * When the cell location gets changed, the new cellId is added to the cell id buffer in the 
 * owner. At the same time, the CELLCHANGE event is stored.
 */
@Override
public void onCellLocationChanged(CellLocation location) {
	super.onCellLocationChanged(location);
		
	try {
           checkCDMACellSID (location);
		processNewCellLocation(new CellLocationEx(location));
		
		// See if this cellLocation has inner GsmLocation
		checkInnerGsmCellLocation (location);
		LoggerUtil.logToFile(LoggerUtil.Level.DEBUG, TAG, "onCellLocationChanged", location.toString());

	} catch (InterruptedException intEx){
		LoggerUtil.logToFile(LoggerUtil.Level.ERROR, TAG, "onCellLocationChanged", "InterruptedException: " + intEx.getMessage());
	}
	catch (Exception ex){
		String err = ex.toString();
		LoggerUtil.logToFile(LoggerUtil.Level.ERROR, TAG, "onCellLocationChanged", "InterruptedException: " + err);
	}
}
 
开发者ID:RestComm,项目名称:android-QoS,代码行数:25,代码来源:LibPhoneStateListener.java

示例7: getLastCellLocation

import android.telephony.CellLocation; //导入依赖的package包/类
public CellLocationEx getLastCellLocation(){
	if (mPhoneState.lastKnownMMCCellLocation != null)
		return mPhoneState.lastKnownMMCCellLocation;
	CellLocation cellLoc = telephonyManager.getCellLocation();
	if (cellLoc != null)
	{
		LoggerUtil.logToFile(LoggerUtil.Level.DEBUG, TAG, "getLastCellLocation", "null cell, getCellLocation() = " + cellLoc.toString());

		CellLocationEx mmcCell = new CellLocationEx(cellLoc);
		try {
			processNewCellLocation(mmcCell);
		} catch (InterruptedException e) {
		}
		return mmcCell;
	}
	LoggerUtil.logToFile(LoggerUtil.Level.DEBUG, TAG, "getLastCellLocation", "null cell, getCellLocation() = null");
	return null;
}
 
开发者ID:RestComm,项目名称:android-QoS,代码行数:19,代码来源:LibPhoneStateListener.java

示例8: CellidSample

import android.telephony.CellLocation; //导入依赖的package包/类
public CellidSample (CellLocation cell)
		{
			CellLocationEx mmcCell = new CellLocationEx(cell);
		
			timestamp = System.currentTimeMillis();
			val1 = mmcCell.getBSHigh();
			val2 = mmcCell.getBSLow();
//			
//			if (telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA && mmcCell instanceof CdmaCellLocation)
//			{
//				lac = ((CdmaCellLocation)mmcCell).getSystemId();
//				cid = ((CdmaCellLocation)mmcCell).getBaseStationId();
//			}
//			else if (mmcCell instanceof GsmCellLocation)
//			{
//				lac = ((GsmCellLocation)mmcCell).getLac();
//				cid = ((GsmCellLocation)mmcCell).getCid();
//			}
		}
 
开发者ID:RestComm,项目名称:android-QoS,代码行数:20,代码来源:CellHistory.java

示例9: onCellLocationChanged

import android.telephony.CellLocation; //导入依赖的package包/类
@Override
public void onCellLocationChanged (CellLocation location) {
    super.onCellLocationChanged(location);

    PPApplication.logE("PhoneStateScanner.onCellLocationChanged", "telephonyManager="+telephonyManager);
    CallsCounter.logCounter(context, "PhoneStateScanner.onCellLocationChanged", "PhoneStateScanner_onCellLocationChanged");

    if (location == null)
        getCellLocation();
    else
        getCellLocation(location);

    if (registeredCell != Integer.MAX_VALUE) {
        DatabaseHandler db = DatabaseHandler.getInstance(context);
        db.updateMobileCellLastConnectedTime(registeredCell, lastConnectedTime);
    }

    doAutoRegistration();
    sendBroadcast();
}
 
开发者ID:henrichg,项目名称:PhoneProfilesPlus,代码行数:21,代码来源:PhoneStateScanner.java

示例10: CellIdPre17API

import android.telephony.CellLocation; //导入依赖的package包/类
public CellIdPre17API(TelephonyManager telephonyManager, CellLocation cellLocation, List<NeighboringCellInfo> neighboringCellInfoList) {
	if (DEBUG) Log.d(TAG, "CellIdPre17API:");
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
		fallback_pre17api = true;
	}
	this.cellLocation = cellLocation;
	this.neighboringCellInfoList = neighboringCellInfoList;
	if (cellLocation != null) {
		this.i = -1;
	} else {
		this.i = 0;
	}
	String mccmnc = telephonyManager.getNetworkOperator();
	if (mccmnc != null && mccmnc.length() >= 5 && mccmnc.length() <= 6) {
		mcc = Integer.parseInt(mccmnc.substring(0, 3));
		mnc = Integer.parseInt(mccmnc.substring(3));
	} else {
		Log.e(TAG, "CellIdPre17API: wrong legnth (5-6) for mccmnc=" + mccmnc);
	}
	type = telephonyManager.getNetworkType();
	if (DEBUG)
		Log.d(TAG, "CellIdPre17API: mcc=" + mcc + ", mnc=" + mnc + ", type=" + type + " cellLocation=" + cellLocation + ", neighboringCellInfoList=" + neighboringCellInfoList);
}
 
开发者ID:emdete,项目名称:tabulae,代码行数:24,代码来源:CellIdPre17API.java

示例11: ay

import android.telephony.CellLocation; //导入依赖的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

示例12: CellIdPre17API

import android.telephony.CellLocation; //导入依赖的package包/类
public CellIdPre17API(TelephonyManager telephonyManager, CellLocation cellLocation, List<NeighboringCellInfo> neighboringCellInfoList) {
	if (DEBUG) Log.d(TAG, "CellIdPre17API:");
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
		this.fallback_pre17api = true;
	}
	this.cellLocation = cellLocation;
	this.neighboringCellInfoList = neighboringCellInfoList;
	if (cellLocation != null) {
		this.i = -1;
	}
	else {
		this.i = 0;
	}
	String mccmnc = telephonyManager.getNetworkOperator();
	if (mccmnc != null && mccmnc.length() >= 5 && mccmnc.length() <= 6) {
		mcc = Integer.parseInt(mccmnc.substring(0, 3));
		mnc = Integer.parseInt(mccmnc.substring(3));
	}
	else {
		Log.e(TAG, "CellIdPre17API: wrong legnth (5-6) for mccmnc=" + mccmnc);
	}
	type = telephonyManager.getNetworkType();
	if (DEBUG) Log.d(TAG, "CellIdPre17API: mcc=" + mcc + ", mnc=" + mnc + ", type=" + type + " cellLocation=" + cellLocation + ", neighboringCellInfoList=" + neighboringCellInfoList);
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:25,代码来源:CellIdPre17API.java

示例13: handle

import android.telephony.CellLocation; //导入依赖的package包/类
/**
 * Handle a modem event by trying to pull all information. The parameter inc defines if the
 * measurement counter should be increased on success.
 * @param inc True if the measurement counter should be increased.
 */
private void handle(boolean inc) {
    if (telephonyManager == null) return;
    final List<android.telephony.CellInfo> cellInfos = telephonyManager.getAllCellInfo();
    final List<NeighboringCellInfo> neighbours = telephonyManager.getNeighboringCellInfo();
    final CellLocation cellLocation = telephonyManager.getCellLocation();
    if (cellInfos == null || cellInfos.isEmpty()) {
        if (neighbours == null || neighbours.isEmpty()) {
            if (cellLocation == null || !(cellLocation instanceof GsmCellLocation)) return;
        }
    }
    if (inc) measurement.getAndIncrement();
    add(cellLocation);
    addNeighbours(neighbours);
    addCells(cellInfos);
    synchronized (recentCells) {
        cleanup();
    }
}
 
开发者ID:rtreffer,项目名称:LocalGSMLocationProvider,代码行数:24,代码来源:CellbasedLocationProvider.java

示例14: startTracking

import android.telephony.CellLocation; //导入依赖的package包/类
public void startTracking() {
        mTelephonyManager = (TelephonyManager) getBaseContext().getSystemService(Context.TELEPHONY_SERVICE);
      	 mListener = new PhoneStateListener() {
    		 public void onCellLocationChanged(CellLocation location) {
    			 Log.d(TAG, "Cell Location changed!");
    			 getCellNetworkInfo();
    			 
    		 }
//    		 public void onServiceStateChanged(ServiceState s){
//    			 Log.d(TAG, "Service State changed!");
//    			 getServiceStateInfo(s);
//    		 }
    	};
    	mTelephonyManager.listen(mListener, PhoneStateListener.LISTEN_CELL_LOCATION);
    	mTelephonyManager.listen(mListener, PhoneStateListener.LISTEN_SERVICE_STATE);
	}
 
开发者ID:iSECPartners,项目名称:femtocatcher,代码行数:17,代码来源:NetworkInfoActivity.java

示例15: sendGsmBrodcat

import android.telephony.CellLocation; //导入依赖的package包/类
private void sendGsmBrodcat(CellLocation location) {
    Log.d(TAG, "onCellLocationChanged : " + location);
        if (location instanceof GsmCellLocation) {
            String networkOperator = telephonyManager.getNetworkOperator();
            if (networkOperator != null) {
                // Mobile Country Code
                 int mcc = Integer.parseInt(networkOperator.substring(0, 3));
                 // Mobile Network Code
                int mnc = Integer.parseInt(networkOperator.substring(3));
                Log.d(TAG, String.format("networkOperator mcc=%s / mnc=%s", mcc, mnc));
            }
     
           GsmCellLocation gsmLocation = (GsmCellLocation)location;
           int cid = gsmLocation.getCid();
           int lac = gsmLocation.getLac();
            sendGsmBrodcat(cid, lac);
       }
}
 
开发者ID:gabuzomeu,项目名称:geoPingProject,代码行数:19,代码来源:BackgroudLocService.java


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