List of usage examples for android.telephony TelephonyManager getSubscriberId
@SuppressAutoDoc
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
public String getSubscriberId()
From source file:Main.java
public static String getPhoneStatus(Context context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String str = ""; str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\n"; str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\n"; str += "Line1Number = " + tm.getLine1Number() + "\n"; str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\n"; str += "NetworkOperator = " + tm.getNetworkOperator() + "\n"; str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\n"; str += "NetworkType = " + tm.getNetworkType() + "\n"; str += "honeType = " + tm.getPhoneType() + "\n"; str += "SimCountryIso = " + tm.getSimCountryIso() + "\n"; str += "SimOperator = " + tm.getSimOperator() + "\n"; str += "SimOperatorName = " + tm.getSimOperatorName() + "\n"; str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\n"; str += "SimState = " + tm.getSimState() + "\n"; str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\n"; str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\n"; return str;//from www . ja v a 2 s .c om }
From source file:Main.java
public static String getDeviceInfo(Context context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); StringBuilder sb = new StringBuilder(); sb.append("\nDeviceId(IMEI) = " + tm.getDeviceId()); sb.append("\nDeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion()); sb.append("\nLine1Number = " + tm.getLine1Number()); sb.append("\nNetworkCountryIso = " + tm.getNetworkCountryIso()); sb.append("\nNetworkOperator = " + tm.getNetworkOperator()); sb.append("\nNetworkOperatorName = " + tm.getNetworkOperatorName()); sb.append("\nNetworkType = " + tm.getNetworkType()); sb.append("\nPhoneType = " + tm.getPhoneType()); sb.append("\nSimCountryIso = " + tm.getSimCountryIso()); sb.append("\nSimOperator = " + tm.getSimOperator()); sb.append("\nSimOperatorName = " + tm.getSimOperatorName()); sb.append("\nSimSerialNumber = " + tm.getSimSerialNumber()); sb.append("\nSimState = " + tm.getSimState()); sb.append("\nSubscriberId(IMSI) = " + tm.getSubscriberId()); sb.append("\nVoiceMailNumber = " + tm.getVoiceMailNumber()); return sb.toString(); }
From source file:com.phonegap.Device.java
public String getSubscriberId() { TelephonyManager operator = (TelephonyManager) this.ctx.getSystemService(Context.TELEPHONY_SERVICE); return operator.getSubscriberId(); }
From source file:com.polyvi.xface.extension.devicecapability.XDeviceCapabilityExt.java
/** * ?device?(IMSI)// w ww . jav a2 s .c om * * @param context * @return */ private String getImsi(Context context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); return XStringUtils.isEmptyString(tm.getSubscriberId()) ? "" : tm.getSubscriberId(); }
From source file:org.hygieiasoft.cordova.uid.UID.java
/** * Get the device's International mobile Subscriber Identity (IMSI). * * @param context The context of the main Activity. * @return//from w w w .j av a2 s. c om */ public String getImsi(Context context) { final TelephonyManager mTelephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String imsi = mTelephony.getSubscriberId(); return imsi; }
From source file:com.wso2.mobile.mdm.api.DeviceInfo.java
/** *Returns the IMSI Number//w ww .j av a2s . c om */ public String getIMSINumber() { final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); imsi = tm.getSubscriberId(); return imsi; }
From source file:com.framgia.android.emulator.EmulatorDetector.java
private boolean checkImsi() { TelephonyManager telephonyManager = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE); @SuppressLint("HardwareIds") String imsi = telephonyManager.getSubscriberId(); for (String known_imsi : IMSI_IDS) { if (known_imsi.equalsIgnoreCase(imsi)) { log("Check imsi is detected"); return true; }/*from www . j a va 2 s .c om*/ } return false; }
From source file:com.gmobi.poponews.util.HttpHelper.java
public JSONObject getDeviceInfo() { ;/*from w w w. j a va 2s . c o m*/ TelephonyManager mTelephonyMgr = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE); String imsi = mTelephonyMgr.getSubscriberId(); String imei = mTelephonyMgr.getDeviceId(); JSONObject json = new JSONObject(); try { json.put("app", mContext.getPackageName()); json.put("ch", PreferenceHelper.getCurChannel(mContext)); json.put("group", BuildConfig.GROUP); json.put("app_v", SystemHelper.getAppVersion(mContext)); json.put("imsi", imsi); json.put("imei", imei); json.put("sd", SystemHelper.hasSdcard(mContext)); json.put("ua", SystemHelper.getUA(false)); json.put("os", "android"); json.put("os_v", SystemHelper.getOsVersion()); json.put("lang", Locale.getDefault().getLanguage()); json.put("country", SystemHelper.getCountry(mContext)); json.put("wmac", SystemHelper.getWifiMac(mContext)); json.put("bmac", ""); json.put("sn", SystemHelper.getAndroidId(mContext)); json.put("sa", SystemHelper.isSystemApp(mContext)); json.put("sw", SystemHelper.getScreenWidth(mContext)); json.put("sh", SystemHelper.getScreenHeight(mContext)); json.put("dch", BuildConfig.DISTRIBUTION_CHANNEL); json.put("gref", new JSONObject("{}")); Logger.debug("Send Device Info: " + json.toString(4)); } catch (JSONException e) { Logger.error(e); } return json; }
From source file:com.p2p.misc.DeviceUtility.java
public String getIMSINo() { TelephonyManager tManager = (TelephonyManager) mactivity.getSystemService(Context.TELEPHONY_SERVICE); String imsi = tManager.getSubscriberId(); return imsi;/*from w w w. j ava 2 s . c om*/ }
From source file:com.wbtech.ums.UmsAgent.java
private static JSONObject getClientDataJSONObject(Context context) { TelephonyManager tm = (TelephonyManager) (context.getSystemService(Context.TELEPHONY_SERVICE)); WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); DisplayMetrics displaysMetrics = new DisplayMetrics(); manager.getDefaultDisplay().getMetrics(displaysMetrics); LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); JSONObject clientData = new JSONObject(); try {// w w w . j a v a 2 s.co m clientData.put("os_version", CommonUtil.getOsVersion(context)); clientData.put("platform", "android"); clientData.put("language", Locale.getDefault().getLanguage()); clientData.put("deviceid", tm.getDeviceId() == null ? "" : tm.getDeviceId());// clientData.put("appkey", CommonUtil.getAppKey(context)); clientData.put("resolution", displaysMetrics.widthPixels + "x" + displaysMetrics.heightPixels); clientData.put("ismobiledevice", true); clientData.put("phonetype", tm.getPhoneType());// clientData.put("imsi", tm.getSubscriberId()); clientData.put("network", CommonUtil.getNetworkTypeWIFI2G3G(context)); clientData.put("time", CommonUtil.getTime()); clientData.put("version", CommonUtil.getVersion(context)); clientData.put(UserIdentifier, CommonUtil.getUserIdentifier(context)); SCell sCell = CommonUtil.getCellInfo(context); clientData.put("mccmnc", sCell != null ? "" + sCell.MCCMNC : ""); clientData.put("cellid", sCell != null ? sCell.CID + "" : ""); clientData.put("lac", sCell != null ? sCell.LAC + "" : ""); clientData.put("modulename", Build.PRODUCT); clientData.put("devicename", CommonUtil.getDeviceName()); clientData.put("wifimac", wifiManager.getConnectionInfo().getMacAddress()); clientData.put("havebt", adapter == null ? false : true); clientData.put("havewifi", CommonUtil.isWiFiActive(context)); clientData.put("havegps", locationManager == null ? false : true); clientData.put("havegravity", CommonUtil.isHaveGravity(context));// LatitudeAndLongitude coordinates = CommonUtil.getLatitudeAndLongitude(context, UmsAgent.mUseLocationService); clientData.put("latitude", coordinates.latitude); clientData.put("longitude", coordinates.longitude); CommonUtil.printLog("clientData---------->", clientData.toString()); } catch (JSONException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return clientData; }