Search in sources :

Example 91 with TelephonyManager

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());
}
Also used : TelephonyManager(android.telephony.TelephonyManager)

Example 92 with TelephonyManager

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;
}
Also used : TelephonyManager(android.telephony.TelephonyManager) Method(java.lang.reflect.Method)

Example 93 with TelephonyManager

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;
}
Also used : TelephonyManager(android.telephony.TelephonyManager)

Example 94 with TelephonyManager

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));
    }
}
Also used : TelephonyManager(android.telephony.TelephonyManager) LocationServices(com.secupwn.aimsicd.utils.LocationServices) GeoLocation(com.secupwn.aimsicd.utils.GeoLocation) Cell(com.secupwn.aimsicd.utils.Cell)

Example 95 with TelephonyManager

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);
}
Also used : TelephonyManager(android.telephony.TelephonyManager)

Aggregations

TelephonyManager (android.telephony.TelephonyManager)294 NetworkPolicyManager.uidRulesToString (android.net.NetworkPolicyManager.uidRulesToString)20 SubscriptionManager (android.telephony.SubscriptionManager)20 Test (org.junit.Test)15 ConnectivityManager (android.net.ConnectivityManager)14 Context (android.content.Context)11 Intent (android.content.Intent)11 NetworkIdentity (android.net.NetworkIdentity)11 Method (java.lang.reflect.Method)11 GsmCellLocation (android.telephony.gsm.GsmCellLocation)10 PackageManager (android.content.pm.PackageManager)9 SubscriptionInfo (android.telephony.SubscriptionInfo)9 IntentFilter (android.content.IntentFilter)8 IOException (java.io.IOException)8 PackageInfo (android.content.pm.PackageInfo)7 ServiceState (android.telephony.ServiceState)7 NetworkPolicy (android.net.NetworkPolicy)6 WifiManager (android.net.wifi.WifiManager)6 DevicePolicyManagerInternal (android.app.admin.DevicePolicyManagerInternal)5 SharedPreferences (android.content.SharedPreferences)5