gpt4 book ai didi

安卓手机号

转载 作者:太空狗 更新时间:2023-10-29 13:42:41 24 4
gpt4 key购买 nike

我想从我的手机中获取 cid,我目前正在使用此代码来执行此操作:

GsmCellLocation gsmLocation = (GsmCellLocation)telephonyManager.getCellLocation();
int Cid = gsmLocation.getCid();
Log.e("#############","current cid is: "+Cid);
int lac = gsmLocation.getLac();
Log.e("#############","current lac is: "+lac);

这会返回类似 301 或 6061 的内容。

我在浏览一些示例代码时发现了这个:

/**
* Seems that cid and lac shall be in hex. Cid should be padded with zero's
* to 8 numbers if UMTS (3G) cell, otherwise to 4 numbers. Mcc padded to 3
* numbers. Mnc padded to 2 numbers.
*/
try {
// Update the current location
updateLocation(getPaddedHex(cid, cellPadding), getPaddedHex(lac, 4),
getPaddedInt(mnc, 2), getPaddedInt(mcc, 3));
strResult = "Position updated!";
} catch (IOException e) {
strResult = "Error!\n" + e.getMessage();
}

// Show an info Toast with the results of the updateLocation
// call.
Toast t = Toast.makeText(getApplicationContext(), strResult,
Toast.LENGTH_LONG);
t.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
t.show();}});
}

/**
* Convert an int to an hex String and pad with 0's up to minLen.
*/
String getPaddedHex(int nr, int minLen) {
String str = Integer.toHexString(nr);
if (str != null) {
while (str.length() < minLen) {
str = "0" + str;
}
}
return str;
}

/**
* Convert an int to String and pad with 0's up to minLen.
*/
String getPaddedInt(int nr, int minLen) {
String str = Integer.toString(nr);
if (str != null) {
while (str.length() < minLen) {
str = "0" + str;
}
}
return str;
}

GsmCellLocation 中的数字是否正确,或者我需要更改示例中所示的结果?有什么区别?我从文档中知道 cid 可以是 -1(未知)或 0xffff 最大值,0xffff 用于 2g 或 3g 网络?

最佳答案

该代码并没有真正改变数字。它只是将它们显示为十六进制或左侧有更多零。

关于安卓手机号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3882914/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com