Search in sources :

Example 96 with TelephonyManager

use of android.telephony.TelephonyManager in project Android-IMSI-Catcher-Detector by CellularPrivacy.

the class MapViewerOsmDroid method onCreate.

/**
     * Called when the activity is first created.
     */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    log.info("Starting MapViewer");
    setUpMapIfNeeded();
    mDbHelper = new RealmHelper(this);
    tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
    // Bind to LocalService
    Intent intent = new Intent(this, AimsicdService.class);
    bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
    TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
    tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CELL_LOCATION | PhoneStateListener.LISTEN_DATA_CONNECTION_STATE);
}
Also used : RealmHelper(com.secupwn.aimsicd.utils.RealmHelper) TelephonyManager(android.telephony.TelephonyManager) Intent(android.content.Intent)

Example 97 with TelephonyManager

use of android.telephony.TelephonyManager in project Android-IMSI-Catcher-Detector by CellularPrivacy.

the class MapFragment method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    log.info("Starting MapViewer");
    setUpMapIfNeeded();
    mDbHelper = new RealmHelper(getActivity());
    tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
    // Bind to LocalService
    Intent intent = new Intent(getActivity(), AimsicdService.class);
    getActivity().bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
    TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
    tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CELL_LOCATION | PhoneStateListener.LISTEN_DATA_CONNECTION_STATE);
}
Also used : RealmHelper(com.secupwn.aimsicd.utils.RealmHelper) TelephonyManager(android.telephony.TelephonyManager) Intent(android.content.Intent)

Example 98 with TelephonyManager

use of android.telephony.TelephonyManager in project Aegis by Decad3nce.

the class SIMListFragment method showAddDialog.

private void showAddDialog() {
    final TelephonyManager mTelephonyManager = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
    AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity());
    alertDialog.setTitle(getActivity().getResources().getString(R.string.sim_fragment_add_dialog));
    final EditText input = new EditText(getActivity());
    input.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED);
    alertDialog.setView(input);
    String addButton = getActivity().getResources().getString(R.string.sim_fragment_add_dialog_add);
    String readButton = getActivity().getResources().getString(R.string.sim_fragment_add_dialog_read);
    alertDialog.setPositiveButton(addButton, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int whichButton) {
            if (input.getText().toString() != null) {
                String inputText = input.getText().toString();
                if (!inputText.isEmpty() || !inputText.trim().equals("")) {
                    listItemAdd = Long.parseLong(inputText);
                    updateData();
                    mSIMList.setItemChecked(listItem, false);
                    return;
                }
            }
            Toast.makeText(getActivity(), getResources().getString(R.string.sim_fragment_edit_dialog_null), Toast.LENGTH_LONG).show();
            mSIMList.setItemChecked(listItem, false);
        }
    });
    alertDialog.setNegativeButton(readButton, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int whichButton) {
        //meh
        }
    });
    AlertDialog dialog = alertDialog.create();
    dialog.show();
    dialog.getButton(AlertDialog.BUTTON_NEGATIVE).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            input.setText(mTelephonyManager.getSubscriberId());
        }
    });
}
Also used : AlertDialog(android.app.AlertDialog) TelephonyManager(android.telephony.TelephonyManager) DialogInterface(android.content.DialogInterface)

Example 99 with TelephonyManager

use of android.telephony.TelephonyManager in project AndroidUtilCode by Blankj.

the class PhoneUtils method getSimOperatorByMnc.

/**
     * 获取Sim卡运营商名称
     * <p>中国移动、如中国联通、中国电信</p>
     *
     * @return 移动网络运营商名称
     */
public static String getSimOperatorByMnc() {
    TelephonyManager tm = (TelephonyManager) Utils.getContext().getSystemService(Context.TELEPHONY_SERVICE);
    String operator = tm != null ? tm.getSimOperator() : null;
    if (operator == null)
        return null;
    switch(operator) {
        case "46000":
        case "46002":
        case "46007":
            return "中国移动";
        case "46001":
            return "中国联通";
        case "46003":
            return "中国电信";
        default:
            return operator;
    }
}
Also used : TelephonyManager(android.telephony.TelephonyManager)

Example 100 with TelephonyManager

use of android.telephony.TelephonyManager in project android_frameworks_base by DirtyUnicorns.

the class CarrierLabel method getOperatorName.

private String getOperatorName() {
    String operatorName = getContext().getString(R.string.quick_settings_wifi_no_network);
    TelephonyManager telephonyManager = (TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE);
    if (isCN) {
        String operator = telephonyManager.getNetworkOperator();
        if (TextUtils.isEmpty(operator)) {
            operator = telephonyManager.getSimOperator();
        }
        SpnOverride mSpnOverride = new SpnOverride();
        operatorName = mSpnOverride.getSpn(operator);
    } else {
        operatorName = telephonyManager.getNetworkOperatorName();
    }
    if (TextUtils.isEmpty(operatorName)) {
        operatorName = telephonyManager.getSimOperatorName();
    }
    return operatorName;
}
Also used : TelephonyManager(android.telephony.TelephonyManager) SpnOverride(com.android.systemui.du.carrierlabel.SpnOverride)

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