public static int getCellID(Context context) {
TelephonyManager telephonyManager = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
GsmCellLocation cellLocation = (GsmCellLocation) telephonyManager
.getCellLocation();
int cellID = cellLocation.getCid();
return cellID;
}
java类android.telephony.gsm.GsmCellLocation的实例源码
Utils.java 文件源码
项目:CAN-2015
阅读 22
收藏 0
点赞 0
评论 0
Utils.java 文件源码
项目:CAN-2015
阅读 19
收藏 0
点赞 0
评论 0
public static int getCellLac(Context context) {
TelephonyManager telephonyManager = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
GsmCellLocation cellLocation = (GsmCellLocation) telephonyManager
.getCellLocation();
int lac = cellLocation.getLac();
return lac;
}
PhoneStateScanner.java 文件源码
项目:PhoneProfilesPlus
阅读 22
收藏 0
点赞 0
评论 0
private void getCellLocation(CellLocation location) {
if (location!=null) {
if (Permissions.checkLocation(context.getApplicationContext())) {
if (location instanceof GsmCellLocation) {
GsmCellLocation gcLoc = (GsmCellLocation) location;
//PPApplication.logE("PhoneStateScanner.getCellLocation", "gsm location="+gcLoc);
if (gcLoc.getCid() != -1) {
//PPApplication.logE("PhoneStateScanner.getCellLocation", "gsm mCid="+gcLoc.getCid());
registeredCell = gcLoc.getCid();
lastConnectedTime = Calendar.getInstance().getTimeInMillis();
}
} else if (location instanceof CdmaCellLocation) {
CdmaCellLocation ccLoc = (CdmaCellLocation) location;
//PPApplication.logE("PhoneStateScanner.getCellLocation", "cdma location="+ccLoc);
if (ccLoc.getBaseStationId() != -1) {
//PPApplication.logE("PhoneStateScanner.getCellLocation", "cdma mCid="+ccLoc.getBaseStationId());
registeredCell = ccLoc.getBaseStationId();
lastConnectedTime = Calendar.getInstance().getTimeInMillis();
}
}
//else {
// PPApplication.logE("PhoneStateScanner.getCellLocation", "unknown location="+location);
//}
PPApplication.logE("PhoneStateScanner.getCellLocation", "registeredCell=" + registeredCell);
}
}
else
PPApplication.logE("PhoneStateScanner.getCellLocation", "location is null");
}
CellIdPre17API.java 文件源码
项目:tabulae
阅读 19
收藏 0
点赞 0
评论 0
public void fill(TheDictionary map, GsmCellLocation value) throws Exception {
if (value != null) {
map.put("mcc", mcc);
map.put("mnc", mnc);
map.put("cid", value.getCid());
map.put("lac", value.getLac());
map.put("psc", value.getPsc());
map.put("registered", true);
determine_type(map);
}
}
ai.java 文件源码
项目:MiBandDecompiled
阅读 32
收藏 0
点赞 0
评论 0
protected final List a(float f1)
{
ArrayList arraylist;
label0:
{
arraylist = new ArrayList();
long l1 = System.currentTimeMillis();
if (Math.abs(f1) <= 1.0F)
{
f1 = 1.0F;
}
if (c())
{
CellLocation celllocation = (CellLocation)j().get(1);
if (celllocation != null && (celllocation instanceof GsmCellLocation))
{
arraylist.add(Integer.valueOf(((GsmCellLocation)celllocation).getLac()));
arraylist.add(Integer.valueOf(((GsmCellLocation)celllocation).getCid()));
if ((double)(l1 - ((Long)j().get(0)).longValue()) > 50000D / (double)f1)
{
break label0;
}
arraylist.add(Integer.valueOf(1));
}
}
return arraylist;
}
arraylist.add(Integer.valueOf(0));
return arraylist;
}
WirelessLoggerService.java 文件源码
项目:radiocells-scanner-android
阅读 30
收藏 0
点赞 0
评论 0
/**
* Create a {@link CellRecord} for the serving cell by parsing {@link CellLocation}
*
* @param cell {@link CellLocation}
* @param position {@link PositionRecord} Current position
* @return Serialized cell record
*/
@SuppressLint("NewApi")
private CellRecord processServingCellLocation(final CellLocation cell, final PositionRecord position) {
if (cell instanceof GsmCellLocation) {
/*
* In case of GSM network set GSM specific values
*/
final GsmCellLocation gsmLocation = (GsmCellLocation) cell;
if (isValidGsmCell(gsmLocation)) {
Log.i(TAG, "Assuming gsm (assumption based on cell-id" + gsmLocation.getCid() + ")");
final CellRecord serving = processGsm(position, gsmLocation);
if (serving == null) {
return null;
}
return serving;
}
} else if (cell instanceof CdmaCellLocation) {
final CdmaCellLocation cdmaLocation = (CdmaCellLocation) cell;
if (isValidCdmaCell(cdmaLocation)) {
/*
* In case of CDMA network set CDMA specific values
* Assume CDMA network, if cdma location and basestation, network and system id are available
*/
Log.i(TAG, "Assuming cdma for cell " + cdmaLocation.getBaseStationId());
return processCdma(position, cdmaLocation);
}
}
return null;
}
WirelessLoggerService.java 文件源码
项目:radiocells-scanner-android
阅读 25
收藏 0
点赞 0
评论 0
/**
* A valid gsm cell must have cell id != -1
* Note: cells with cid > max value 0xffff are accepted (typically UMTS cells. We handle them separately
*
* @param gsmLocation {@link GsmCellLocation}
* @return true if valid gsm cell
*/
private boolean isValidGsmCell(final GsmCellLocation gsmLocation) {
if (gsmLocation == null) {
return false;
}
final Integer cid = gsmLocation.getCid();
return (cid > 0 && cid != Integer.MAX_VALUE);
}
PhoneStateHelper.java 文件源码
项目:SignalAnalysis
阅读 24
收藏 0
点赞 0
评论 0
/**
* Set network info related to the connected cell: MCC, MNC, LAC, CellId
*/
public void setNetworkInfo() {
if (DBG)
Log.d(Config.TAG, TAG + "setNetworkInfo called");
String temp = mTelMgr.getNetworkOperator();
if ((temp != null) && (temp.length() >= 5)) {
mMcc = temp.substring(0, 3);
mMnc = temp.substring(3);
}
CellLocation oCell = mTelMgr.getCellLocation();
if (oCell instanceof GsmCellLocation) {
mLac = String.valueOf(((GsmCellLocation) oCell).getLac());
mCellId = String.valueOf(((GsmCellLocation) oCell).getCid());
mPsc = String.valueOf(((GsmCellLocation) oCell).getPsc());
}
if (oCell instanceof CdmaCellLocation) {
String t = null;
// (CdmaCellLocation) oCell
t = "Base station id : "
+ ((CdmaCellLocation) oCell).getBaseStationId()
+ "base station latitude "
+ ((CdmaCellLocation) oCell).getBaseStationLatitude()
+ " base station longitude"
+ ((CdmaCellLocation) oCell).getBaseStationLongitude()
+ " network id" + ((CdmaCellLocation) oCell).getNetworkId()
+ " system id " + ((CdmaCellLocation) oCell).getSystemId();
Log.d(Config.TAG, TAG + t);
}
}
NetworkUtils.java 文件源码
项目:Office-365-SDK-for-Android
阅读 30
收藏 0
点赞 0
评论 0
/**
* Retrieves network info data. *
*
* @return Current network info data.
*/
public static NetworkState getNetworkState(Context context) {
NetworkState callInfoData = null;
try {
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
GsmCellLocation location = (GsmCellLocation) telephonyManager.getCellLocation();
String mcc = "0";
String mnc = "0";
String networkOperator = telephonyManager.getNetworkOperator();
if (networkOperator != null && networkOperator.length() > 0) {
mcc = telephonyManager.getNetworkOperator().substring(0, 3);
mnc = telephonyManager.getNetworkOperator().substring(3);
}
int[] neighborCellId;
int[] neighborCellRssi;
List<NeighboringCellInfo> neighboringList = telephonyManager.getNeighboringCellInfo();
if (neighboringList != null && !neighboringList.isEmpty()) {
neighborCellId = new int[neighboringList.size()];
neighborCellRssi = new int[neighboringList.size()];
for (int i = 0; i < neighboringList.size(); i++) {
neighborCellRssi[i] = neighboringList.get(i).getRssi();
neighborCellId[i] = neighboringList.get(i).getCid();
}
} else {
neighborCellId = new int[] { -1 };
neighborCellRssi = new int[] { -1 };
}
callInfoData = new NetworkState(System.currentTimeMillis(), (location != null) ? location.getCid() : 0, /* rssi, dbm, asu, */0, 0, 0,
mcc, mnc, (location != null) ? location.getLac() : 0, NetworkUtils.isInRoaming(context),
NetworkUtils.getDataConnectionState(context), NetworkUtils.getSimState(context), NetworkUtils.getNetworkType(context),
NetworkUtils.isWiFiEnabled(context), neighborCellId, neighborCellRssi);
} catch (final Exception e) {
Logger.logApplicationException(e, NetworkUtils.class.getSimpleName() + ".getNetworkInfoData(): Failed.");
e.printStackTrace();
}
return callInfoData;
}
CellIdPre17API.java 文件源码
项目:Simplicissimus
阅读 21
收藏 0
点赞 0
评论 0
@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;
}