本文整理汇总了Java中android.telephony.cdma.CdmaCellLocation.getSystemId方法的典型用法代码示例。如果您正苦于以下问题:Java CdmaCellLocation.getSystemId方法的具体用法?Java CdmaCellLocation.getSystemId怎么用?Java CdmaCellLocation.getSystemId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.telephony.cdma.CdmaCellLocation
的用法示例。
在下文中一共展示了CdmaCellLocation.getSystemId方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
}
}
示例3: 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 };
}
示例4: 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;
}
示例5: checkCDMACellSID
import android.telephony.cdma.CdmaCellLocation; //导入方法依赖的package包/类
private void checkCDMACellSID (CellLocation cell)
{
if (cell instanceof CdmaCellLocation)
{
CdmaCellLocation cdmaCell = (CdmaCellLocation)cell;
if (cdmaCell.getSystemId() <= 0)
{
Field getSIDPointer = null;
Field getNIDPointer = null;
int SID = 0, NID = 0, BID = cdmaCell.getBaseStationId();
try {
getSIDPointer = mPhoneState.previousServiceStateObj.getClass().getDeclaredField("mSystemId");
if (getSIDPointer != null)
{
getSIDPointer.setAccessible(true);
SID = (int) getSIDPointer.getInt(cdmaCell);
}
getNIDPointer = mPhoneState.previousServiceStateObj.getClass().getDeclaredField("mNetworkId");
if (getNIDPointer != null)
{
getNIDPointer.setAccessible(true);
NID = (int) getNIDPointer.getInt(cdmaCell);
}
cdmaCell.setCellLocationData(BID, cdmaCell.getBaseStationLatitude(), cdmaCell.getBaseStationLongitude(),
SID, NID); // Update the SID and NID that we read from teh Servicestate
} catch (Exception e) {
//MMCLogger.logToFile(MMCLogger.Level.ERROR, TAG, "checkInnerGsmCellLocation","Field does not exist - mGsmCellLoc");
}
}
}
}
示例6: 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));
}
示例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));
}
示例8: 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);
}
}
}
}
示例9: 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;
}
示例10: 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);
}
示例11: 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;
}