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);
}
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);
}
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());
}
});
}
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;
}
}
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;
}
Aggregations