use of android.telephony.TelephonyManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ImeiInformation method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mSubscriptionManager = SubscriptionManager.from(getContext());
final TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
initPreferenceScreen(telephonyManager.getSimCount());
}
use of android.telephony.TelephonyManager in project android-common by litesuits.
the class TelephoneUtil method getQualcommTeleInfo.
/**
* Qualcomm Phone.
* 获取 高通 神机的双卡 IMSI、IMSI 信息
*/
public static TeleInfo getQualcommTeleInfo(Context context) {
TeleInfo teleInfo = new TeleInfo();
try {
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
Class<?> simTMclass = Class.forName("android.telephony.MSimTelephonyManager");
Object sim = context.getSystemService("phone_msim");
int simId_1 = 0;
int simId_2 = 1;
Method getSubscriberId = simTMclass.getMethod("getSubscriberId", int.class);
String imsi_1 = (String) getSubscriberId.invoke(sim, simId_1);
String imsi_2 = (String) getSubscriberId.invoke(sim, simId_2);
teleInfo.imsi_1 = imsi_1;
teleInfo.imsi_2 = imsi_2;
Method getDeviceId = simTMclass.getMethod("getDeviceId", int.class);
String imei_1 = (String) getDeviceId.invoke(sim, simId_1);
String imei_2 = (String) getDeviceId.invoke(sim, simId_2);
teleInfo.imei_1 = imei_1;
teleInfo.imei_2 = imei_2;
Method getDataState = simTMclass.getMethod("getDataState");
int phoneType_1 = tm.getDataState();
int phoneType_2 = (Integer) getDataState.invoke(sim);
teleInfo.phoneType_1 = phoneType_1;
teleInfo.phoneType_2 = phoneType_2;
} catch (Exception e) {
e.printStackTrace();
}
Log.i(TAG, "Qualcomm: " + teleInfo);
return teleInfo;
}
use of android.telephony.TelephonyManager in project android-common by litesuits.
the class TelephoneUtil method getIMSI.
/**
* IMSI是国际移动用户识别码的简称(International Mobile Subscriber Identity)
* IMSI共有15位,其结构如下:
* MCC+MNC+MIN
* MCC:Mobile Country Code,移动国家码,共3位,中国为460;
* MNC:Mobile NetworkCode,移动网络码,共2位
* 在中国,移动的代码为电00和02,联通的代码为01,电信的代码为03
* 合起来就是(也是Android手机中APN配置文件中的代码):
* 中国移动:46000 46002
* 中国联通:46001
* 中国电信:46003
* 举例,一个典型的IMSI号码为460030912121001
*/
public static String getIMSI(Context context) {
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
String IMSI = telephonyManager.getSubscriberId();
Log.i(TAG, " IMSI:" + IMSI);
return IMSI;
}
use of android.telephony.TelephonyManager in project Android-IMSI-Catcher-Detector by CellularPrivacy.
the class MainActivity method downloadBtsDataIfApiKeyAvailable.
private void downloadBtsDataIfApiKeyAvailable() {
if (CellTracker.OCID_API_KEY != null && !CellTracker.OCID_API_KEY.equals("NA")) {
Cell cell = new Cell();
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String networkOperator = tm.getNetworkOperator();
if (networkOperator != null && !networkOperator.isEmpty()) {
int mcc = Integer.parseInt(networkOperator.substring(0, 3));
cell.setMobileCountryCode(mcc);
int mnc = Integer.parseInt(networkOperator.substring(3));
cell.setMobileNetworkCode(mnc);
log.debug("CELL:: mobileCountryCode=" + mcc + " mobileNetworkCode=" + mnc);
}
GeoLocation loc = mAimsicdService.lastKnownLocation();
if (loc != null) {
Helpers.msgLong(this, getString(R.string.contacting_opencellid_for_data));
cell.setLon(loc.getLongitudeInDegrees());
cell.setLat(loc.getLatitudeInDegrees());
Helpers.getOpenCellData(this, cell, RequestTask.DBE_DOWNLOAD_REQUEST, mAimsicdService);
} else {
Helpers.msgShort(this, getString(R.string.waiting_for_location));
// This uses the LocationServices to get CID/LAC/MNC/MCC to be used
// for grabbing the BTS data from OCID, via their API.
// CID Location Async Output Delegate Interface Implementation
LocationServices.LocationAsync locationAsync = new LocationServices.LocationAsync();
locationAsync.delegate = this;
locationAsync.execute(mAimsicdService.getCell().getCellId(), mAimsicdService.getCell().getLocationAreaCode(), mAimsicdService.getCell().getMobileNetworkCode(), mAimsicdService.getCell().getMobileCountryCode());
}
} else {
Helpers.sendMsg(this, getString(R.string.no_opencellid_key_detected));
}
}
use of android.telephony.TelephonyManager in project Android-IMSI-Catcher-Detector by CellularPrivacy.
the class MapViewerOsmDroid method onDestroy.
@Override
protected void onDestroy() {
super.onDestroy();
prefs.unregisterOnSharedPreferenceChangeListener(this);
// Unbind from the service
if (mBound) {
unbindService(mConnection);
mBound = false;
}
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
LocalBroadcastManager.getInstance(this).unregisterReceiver(mMessageReceiver);
}
Aggregations