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


Java CdmaCellLocation.getNetworkId方法代码示例

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


在下文中一共展示了CdmaCellLocation.getNetworkId方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: 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

示例4: 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

示例5: 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

示例6: getCellInfo

import android.telephony.cdma.CdmaCellLocation; //导入方法依赖的package包/类
public static CellInfo getCellInfo(Context context) {
      CellInfo cellInfo = new CellInfo();

      TelephonyManager manager = (TelephonyManager)
              context.getSystemService(Context.TELEPHONY_SERVICE);

      String netOperator = manager.getNetworkOperator();

      // Fix crash when not connected to network (airplane mode, underground,
      // etc)
      if (netOperator == null || netOperator.length() < 3) {
          return cellInfo;
      }

/*
 * FIXME: Actually check for mobile network status == connected before
 * doing this stuff.
 */

      if (Phone.getType(context).equals(PHONE_TYPE_CDMA)) {
          CdmaCellLocation cdmaLocation = (CdmaCellLocation) manager.getCellLocation();

          cellInfo.cid = cdmaLocation.getBaseStationId();
          cellInfo.lac = cdmaLocation.getNetworkId();
          cellInfo.mnc = cdmaLocation.getSystemId();
          cellInfo.mcc = Integer.parseInt(netOperator.substring(0, 3));
          cellInfo.radioType = Network.getMobileNetworkType(context);
      } else if (Phone.getType(context).equals(PHONE_TYPE_GSM)) {
          GsmCellLocation gsmLocation = (GsmCellLocation) manager.getCellLocation();

          cellInfo.mcc = Integer.parseInt(netOperator.substring(0, 3));
          cellInfo.mnc = Integer.parseInt(netOperator.substring(3));
          cellInfo.lac = gsmLocation.getLac();
          cellInfo.cid = gsmLocation.getCid();
          cellInfo.radioType = Network.getMobileNetworkType(context);
      }

      return cellInfo;
  }
 
开发者ID:greenhub-project,项目名称:batteryhub,代码行数:40,代码来源:Gsm.java

示例7: isValidCdmaCell

import android.telephony.cdma.CdmaCellLocation; //导入方法依赖的package包/类
/**
 * A valid cdma cell must have basestation id, network id and system id set
 * @param cdmaLocation {@link CdmaCellLocation}
 * @return true if valid cdma id
 */
private boolean isValidCdmaCell(final CdmaCellLocation cdmaLocation) {
	if (cdmaLocation == null) {
		return false;
	}
	return ((cdmaLocation.getBaseStationId() != -1) && (cdmaLocation.getNetworkId() != -1) && (cdmaLocation.getSystemId() != -1));
}
 
开发者ID:saintbyte,项目名称:openbmap,代码行数:12,代码来源:WirelessLoggerService.java

示例8: isValidCdmaCell

import android.telephony.cdma.CdmaCellLocation; //导入方法依赖的package包/类
/**
 * A valid cdma cell must have basestation id, network id and system id set
 *
 * @param cdmaLocation {@link CdmaCellLocation}
 * @return true if valid cdma id
 */
private boolean isValidCdmaCell(final CdmaCellLocation cdmaLocation) {
    if (cdmaLocation == null) {
        return false;
    }
    return ((cdmaLocation.getBaseStationId() != -1) && (cdmaLocation.getNetworkId() != -1) && (cdmaLocation.getSystemId() != -1));
}
 
开发者ID:openbmap,项目名称:radiocells-scanner-android,代码行数:13,代码来源:WirelessLoggerService.java

示例9: getCellNetworkInfo

import android.telephony.cdma.CdmaCellLocation; //导入方法依赖的package包/类
public void getCellNetworkInfo() {
	
	if(mTelephonyManager != null) {
		text1 = "";
		Log.v(TAG, "getting cell network info");
		int phoneType = mTelephonyManager.getPhoneType();
		
		/* Check whether you are connected to a CDMA network */
		if(TelephonyManager.PHONE_TYPE_CDMA == phoneType) {
			text1 = text1 + "Cell on CDMA Phone network";
		}
		else {
			text1 = text1 + "Cell is not on CDMA Phone network";
			tv1.setText(text1);
			return;
		}
		
		/* Get the network type and name*/
		if(mTelephonyManager!=null) {
			int networkType = mTelephonyManager.getNetworkType();
			text1 = text1 + "\nNetwork Type = " + MainActivity.getNetworkTypeName(networkType);
			
			/* get network operator name */
			String operatorName = mTelephonyManager.getNetworkOperatorName();
			text1 = text1 +"\nNetwork Operator Name: "+operatorName;
			
			/* get CDMA cell location information */
			CdmaCellLocation c = (CdmaCellLocation) mTelephonyManager.getCellLocation();
			if(c!=null) {
				text1 = text1 + "\nBaseStation ID: "+c.getBaseStationId();
				text1 = text1 + "\nNetwork ID: "+c.getNetworkId();
				text1 = text1 + "\nSystem ID: "+c.getSystemId();				
				text1 = text1 + "\nLatitude: "+c.getBaseStationLatitude();
				text1 = text1 + "\nLongitude: "+c.getBaseStationLongitude();
				
				tv1.setText(text1);
			}
		}
	}
}
 
开发者ID:iSECPartners,项目名称:femtocatcher,代码行数:41,代码来源:NetworkInfoActivity.java

示例10: getLastCellSeen

import android.telephony.cdma.CdmaCellLocation; //导入方法依赖的package包/类
public long getLastCellSeen (CellLocation cellLoc) // MMCCellLocationOld cellInfo)
	{
		if (cellLoc == null)
			return -1;
		if (tmLastCellUpdate + 60000 > System.currentTimeMillis() && cellLoc.toString().equals(lastCellString))
			return - 1;
		long timelastSeen = 0;
		tmLastCellUpdate = System.currentTimeMillis();
		
		// Is it reporting an unknown cell id? ignore those
//        int cellId = 0;//cellInfo.getBSLow(); //low
//        if (telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM && cellLoc instanceof GsmCellLocation)
//			cellId = ((GsmCellLocation)cellLoc).getCid();
//		else if (telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA && cellLoc instanceof CdmaCellLocation)
//			cellId = ((CdmaCellLocation)cellLoc).getBaseStationId();
//		if (cellId <= 0)
//			return -1;
		
		CellidSample smp = new CellidSample(cellLoc);
		cell_history.add (smp);
		
		// How long has it been since we last saw this basestation
        //int bs_high = cellInfo.getBSHigh(), bs_mid = cellInfo.getBSMid(), bs_low = cellInfo.getBSLow();
		int bs_high = 0, bs_mid = 0, bs_low = 0;
        if (telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM && cellLoc instanceof GsmCellLocation)
        {
			GsmCellLocation gsmCellLocation = (GsmCellLocation)cellLoc;
			bs_high = gsmCellLocation.getLac();
			bs_mid = gsmCellLocation.getCid() >> 16;
			bs_low = gsmCellLocation.getCid() & 0xffff;
        }
		else if (telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA && cellLoc instanceof CdmaCellLocation)
		{
			CdmaCellLocation cdmaCellLocation = (CdmaCellLocation) cellLoc;
			bs_high = cdmaCellLocation.getSystemId();
			bs_mid = cdmaCellLocation.getNetworkId();
			bs_low = cdmaCellLocation.getBaseStationId();
		}
		if (bs_low <= 0)
			return -1;
        int j;
        int histlen = cell_history.size();
		// How long has it been since we last saw this basestation
		long timestamp = System.currentTimeMillis();
		for (j=histlen-2; j>=0; j--)
		{
			if (cell_history.get(j).val2 == bs_low) //  && cell_history.get(j).val1 == bs_high)
			{
				// time last seen is the first timestamp after the cell was last seen
				// (the time this cell handed off to another cell)
				// (if the last known cell was this same cell, then the time last seen is now)
				timelastSeen = timestamp;  
				break;
			}
			else
				timestamp = cell_history.get(j).timestamp;
			
		}
		
		return timelastSeen;
	}
 
开发者ID:RestComm,项目名称:android-QoS,代码行数:62,代码来源:CellHistory.java

示例11: onLocationChanged

import android.telephony.cdma.CdmaCellLocation; //导入方法依赖的package包/类
@Override
   public void onLocationChanged(Location location) {
       // Report to the UI that the location was updated
	String[] data = new String[5];
data[0] = String.valueOf(location.getLatitude());
data[1] = String.valueOf(location.getLongitude());
TelephonyManager telephonyManager = (TelephonyManager) activity
		.getSystemService(Context.TELEPHONY_SERVICE);
CellLocation cellLocation = telephonyManager.getCellLocation();
String cellLocationData = "[]";
switch (telephonyManager.getPhoneType()) {
case TelephonyManager.PHONE_TYPE_NONE:
	cellLocationData = "[" + TelephonyManager.PHONE_TYPE_NONE + "]";
	break;
case TelephonyManager.PHONE_TYPE_CDMA:
	CdmaCellLocation cdmaLocation = (CdmaCellLocation) cellLocation;
	cellLocationData = "[" + TelephonyManager.PHONE_TYPE_CDMA
			+ cdmaLocation.getBaseStationId() + ", "
			+ cdmaLocation.getBaseStationLatitude() + ", "
			+ cdmaLocation.getBaseStationLongitude() + ", " 
			+ cdmaLocation.getSystemId() + ", "
			+ cdmaLocation.getNetworkId() + "]";
	break;
case TelephonyManager.PHONE_TYPE_GSM:
	GsmCellLocation gsmLocation = (GsmCellLocation) cellLocation;
	cellLocationData = "[" + TelephonyManager.PHONE_TYPE_GSM + ", "
			+ gsmLocation.getLac() + ", " + gsmLocation.getCid() + ", "
			+ gsmLocation.getPsc() + "]";
	break;
}
;

data[2] = cellLocationData;
data[3] = "[]";
data[4] = "[]";

SettingsDB helper = new SettingsDB(activity.getBaseContext());
SQLiteDatabase db = helper.getWritableDatabase();
String[] columns = SettingsDB.LOCATION_TABLE_COLUMNS;
ContentValues values = new ContentValues();

for (int i = 0; i < columns.length; i++)
	values.put(columns[i], data[i]);

db.replace(SettingsDB.LOCATION_STATES_TABLE, null, values);
Toast.makeText(activity, "Current location has been added",
		Toast.LENGTH_SHORT).show();
db.close();

activity.getLocationClient().removeLocationUpdates(this);
    }
 
开发者ID:c0d1ngb4d,项目名称:ASA,代码行数:52,代码来源:AdvancedLocationSettingsController.java

示例12: update

import android.telephony.cdma.CdmaCellLocation; //导入方法依赖的package包/类
/**
 * Adds or updates a cell tower.
 * <p>
 * If the cell tower is already in the list, it is replaced; if not, a new
 * entry is created.
 * <p>
 * This method will set the cell's identity data. After this call,
 * {@link #isServing()} will return {@code true} for this cell. 
 * @return The new or updated entry.
 */
public CellTowerCdma update(CdmaCellLocation location) {
	CellTowerCdma result = this.get(location.getSystemId(), location.getNetworkId(), location.getBaseStationId());
	if (result == null) {
		result = new CellTowerCdma(location.getSystemId(), location.getNetworkId(), location.getBaseStationId());
		this.put(result.getText(), result);
	}
	result.setCellLocation(true);
	return result;
}
 
开发者ID:mvglasow,项目名称:satstat,代码行数:20,代码来源:CellTowerListCdma.java


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