當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。