1.javaå¦ä½å®ç°çµåå°å¾çå®ä½
2.å¦ä½åä¸ä¸ªç®åçjavaå°å¾ç¼è¾å¨
javaå¦ä½å®ç°çµåå°å¾çå®ä½
CellInfoManager
import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.Context;
import android.telephony.CellLocation;
import android.telephony.NeighboringCellInfo;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.telephony.gsm.GsmCellLocation;
import android.util.Log;
public class CellInfoManager {
private int asu;
private int bid;
private int cid;
private boolean isCdma;
private boolean isGsm;
private int lac;
private int lat;
private final PhoneStateListener listener;
private int lng;
private int mcc;
private int mnc;
private int nid;
private int sid;
private TelephonyManager tel;
private boolean valid;
private Context context;
public CellInfoManager(Context paramContext) {
this.listener = new CellInfoListener(this);
tel = (TelephonyManager) paramContext.getSystemService(Context.TELEPHONY_SERVICE);
this.tel.listen(this.listener,写地序源a写写android缓存清理源码 PhoneStateListener.LISTEN_CELL_LOCATION | PhoneStateListener.LISTEN_SIGNAL_STRENGTH);
context = paramContext;
}
public static int dBm(int i) {
int j;
if (i >= 0 && i <= )
j = i * 2 + -;
else
j = 0;
return j;
}
public int asu() {
return this.asu;
}
public int bid() {
if (!this.valid)
update();
return this.bid;
}
public JSONObject cdmaInfo() {
if (!isCdma()) {
return null;
}
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("bid", bid());
jsonObject.put("sid", sid());
jsonObject.put("nid", nid());
jsonObject.put("lat", lat());
jsonObject.put("lng", lng());
} catch (JSONException ex) {
jsonObject = null;
Log.e("CellInfoManager", ex.getMessage());
}
return jsonObject;
}
public JSONArray cellTowers() {
JSONArray jsonarray = new JSONArray();
int lat;
int mcc;
int mnc;
int aryCell[] = dumpCells();
lat = lac();
mcc = mcc();
mnc = mnc();
if (aryCell == null || aryCell.length < 2) {
aryCell = new int[2];
aryCell[0] = cid;
aryCell[1] = -;
}
for (int i = 0; i < aryCell.length; i += 2) {
try {
int j2 = dBm(i + 1);
JSONObject jsonobject = new JSONObject();
jsonobject.put("cell_id", aryCell[i]);
jsonobject.put("location_area_code", lat);
jsonobject.put("mobile_country_code", mcc);
jsonobject.put("mobile_network_code", mnc);
jsonobject.put("signal_strength", j2);
jsonobject.put("age", 0);
jsonarray.put(jsonobject);
} catch (Exception ex) {
ex.printStackTrace();
Log.e("CellInfoManager", ex.getMessage());
}
}
if (isCdma())
jsonarray = new JSONArray();
return jsonarray;
}
public int cid() {
if (!this.valid)
update();
return this.cid;
}
public int[] dumpCells() {
int[] aryCells;
if (cid() == 0) {
aryCells = new int[0];
return aryCells;
}
List<NeighboringCellInfo> lsCellInfo = this.tel.getNeighboringCellInfo();
if (lsCellInfo == null || lsCellInfo.size() == 0) {
aryCells = new int[1];
int i = cid();
aryCells[0] = i;
æ£ä¸¾è¡¥å åçï¼
return aryCells;
}
int[] arrayOfInt1 = new int[lsCellInfo.size() * 2 + 2];
int j = 0 + 1;
int k = cid();
arrayOfInt1[0] = k;
int m = j + 1;
int n = asu();
arrayOfInt1[j] = n;
Iterator<NeighboringCellInfo> iter = lsCellInfo.iterator();
while (true) {
if (!iter.hasNext()) {
break;
}
NeighboringCellInfo localNeighboringCellInfo = (NeighboringCellInfo) iter.next();
int i2 = localNeighboringCellInfo.getCid();
if ((i2 <= 0) || (i2 == ))
continue;
int i3 = m + 1;
arrayOfInt1[m] = i2;
m = i3 + 1;
int i4 = localNeighboringCellInfo.getRssi();
arrayOfInt1[i3] = i4;
}
int[] arrayOfInt2 = new int[m];
System.arraycopy(arrayOfInt1, 0, arrayOfInt2, 0, m);
aryCells = arrayOfInt2;
return aryCells;
}
public JSONObject gsmInfo() {
if (!isGsm()) {
return null;
}
JSONObject localObject = null;
while (true) {
try {
æ£ä¸¾è¡¥å åçï¼ JSONObject localJSONObject1 = new JSONObject();
String str1 = this.tel.getNetworkOperatorName();
localJSONObject1.put("operator", str1);
String str2 = this.tel.getNetworkOperator();
if ((str2.length() == 5) || (str2.length() == 6)) {
String str3 = str2.substring(0, 3);
String str4 = str2.substring(3, str2.length());
localJSONObject1.put("mcc", str3);
localJSONObject1.put("mnc", str4);
}
localJSONObject1.put("lac", lac());
int[] arrayOfInt = dumpCells();
JSONArray localJSONArray1 = new JSONArray();
int k = 0;
int m = arrayOfInt.length / 2;
while (true) {
if (k >= m) {
localJSONObject1.put("cells", localJSONArray1);
localObject = localJSONObject1;
break;
}
int n = k * 2;
int i1 = arrayOfInt[n];
int i2 = k * 2 + 1;
int i3 = arrayOfInt[i2];
JSONObject localJSONObject7 = new JSONObject();
localJSONObject7.put("cid", i1);
localJSONObject7.put("asu", i3);
localJSONArray1.put(localJSONObject7);
k += 1;
}
} catch (JSONException localJSONException) {
localObject = null;
}
}
}
public boolean isCdma() {
if (!this.valid)
update();
å¦ä½åä¸ä¸ªç®åçjavaå°å¾ç¼è¾å¨
å°å¾ç¼è¾å¨æè·¯å¦ä¸:è¿ä¸ªå°å°å¾æ¯3x3ç,æ们ç¨æ±å对å®è¿è¡æè¿°:
ç³å¤´ ç©ºç½ éªå°
ç©ºç½ ç å¢ ç©ºç½
æ°´é¢ ç©ºç½ èå°
è¿åä»ä¹? åä¸åäºç»´æ°ç».! æ以æ们å¯ä»¥ä½¿ç¨äºç»´æ°ç»æ¥åå¨ä¸å¯å°å¾.
å½ç¶äºä½¿ç¨æ±åæ¥æè¿°å°å¾, è¿æ¯å¤ªéº»ç¦...
æ们使ç¨æ°åæ¥åå¨æ´å¥½.ææ°åå对åºçå¾çå好ä¸ä¸å¯¹åºçå ³ç³».æ¯å¦0ä»£è¡¨ç©ºç½ 1代表ç³å¤´ ... ç»å¶å°å¾çæ¶å,循ç¯äºç»´æ°ç»,å¦ææ¯1å°±å¨æ¤å¤ç»ç³å¤´,循ç¯å°0å°±ä»ä¹ä¹ä¸ç»ç´æ¥è·³è¿..
æå±,å¦æè¿æ³æç¨å¾®ç«ä½ç¹çææ, å°±æ¯æ¯å¦æèé¾ä»ä¹ç, é£ä¹ä½ å¯ä»¥å»ºç«å¦å¤ä¸ä¸ªå¤©æ°å¾å±çäºç»´æ°ç», è¿ä¸ªæ°ç»å°±æ¯ç»å¶èé¾ç天æ°ç, è¿ä¸ªè¦æåç»å¶, è¿æ ·æè½èµ·å°èé¾å¯¹ä¸é¢å°å¾çé®æ¡..
ç¼è¾å°å¾çæ¶å ,å ç¹å»ä¸ä¸ªå¾ç,表示çä¸éè¦ç»å¶çå¾çæ¯åªä¸ä¸ª.ç¶åå¨ç¼è¾å°å¾çæ¶åæä¸é¼ æ 代表å¼å§å¼å§ç»å¶, ç¶åé¼ æ æå¨å°åªéå°±ç»å¶å°åªé, æåæ¾å¼é¼ æ æ¾å¼, å®æç»å¶
å°å¾çä¿å: äºç»´æ°ç»å¯ä»¥ç´æ¥ææ¯ä¸ªå ç´ åå ¥å°ææ¬æ件é, å½ç¶äºä¹å¯ä»¥ç´æ¥ææ´ä¸ªäºç»´æ°ç»å¯¹è±¡é½åå ¥å°æ件é,使ç¨çæ¶å,ç´æ¥è¯»åè¿åå³å¯
2024-11-21 02:141660人浏览
2024-11-21 01:43144人浏览
2024-11-21 01:382391人浏览
2024-11-21 01:332538人浏览
2024-11-21 00:172014人浏览
2024-11-20 23:49207人浏览
1.自学成才网栏目介绍2.å¦ä½å代ç 3.热门微信小程序demo源码下载汇总17/12.1-7)4.lfs是什么意思,不是游戏的那总意思!5.辽宁定制小程序多少钱自学成才网栏目介绍
1.韩版传奇 2 源码分析与 Unity 重制三)客户端渲染管线2.《合成大西瓜》github源码(GitHub上大西瓜游戏源码分析)3.探索千变万化的网络王国:GTA5辅助发卡网源码剖析4.按键精灵
1.天津网校系统源码2.重庆教育系统培训系统源码3.四川在线教育系统源码4.天津企业培训系统源码天津网校系统源码 突如其来的让线上学习在“停课不停学”期间大范围普及,开启了一场覆盖两三亿师生的在线