當前位置: 首頁>>代碼示例>>Java>>正文


Java TelephonyManager.getSubscriberId方法代碼示例

本文整理匯總了Java中android.telephony.TelephonyManager.getSubscriberId方法的典型用法代碼示例。如果您正苦於以下問題:Java TelephonyManager.getSubscriberId方法的具體用法?Java TelephonyManager.getSubscriberId怎麽用?Java TelephonyManager.getSubscriberId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.telephony.TelephonyManager的用法示例。


在下文中一共展示了TelephonyManager.getSubscriberId方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getPhoneStatus

import android.telephony.TelephonyManager; //導入方法依賴的package包/類
/**
 * 獲取手機狀態信息
 * <p>需添加權限 {@code <uses-permission android:name="android.permission.READ_PHONE_STATE"/>}</p>
 *
 * @return DeviceId(IMEI) = 99000311726612<br>
 * DeviceSoftwareVersion = 00<br>
 * Line1Number =<br>
 * NetworkCountryIso = cn<br>
 * NetworkOperator = 46003<br>
 * NetworkOperatorName = 中國電信<br>
 * NetworkType = 6<br>
 * honeType = 2<br>
 * SimCountryIso = cn<br>
 * SimOperator = 46003<br>
 * SimOperatorName = 中國電信<br>
 * SimSerialNumber = 89860315045710604022<br>
 * SimState = 5<br>
 * SubscriberId(IMSI) = 460030419724900<br>
 * VoiceMailNumber = *86<br>
 */
public static String getPhoneStatus() {
    TelephonyManager tm = (TelephonyManager) Utils.getContext()
            .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;
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:42,代碼來源:PhoneUtils.java

示例2: getPhoneStatus

import android.telephony.TelephonyManager; //導入方法依賴的package包/類
/**
 * 獲取手機狀態信息
 * <p>需添加權限 {@code <uses-permission android:name="android.permission.READ_PHONE_STATE"/>}</p>
 *
 * @return DeviceId(IMEI) = 99000311726612<br>
 * DeviceSoftwareVersion = 00<br>
 * Line1Number =<br>
 * NetworkCountryIso = cn<br>
 * NetworkOperator = 46003<br>
 * NetworkOperatorName = 中國電信<br>
 * NetworkType = 6<br>
 * honeType = 2<br>
 * SimCountryIso = cn<br>
 * SimOperator = 46003<br>
 * SimOperatorName = 中國電信<br>
 * SimSerialNumber = 89860315045710604022<br>
 * SimState = 5<br>
 * SubscriberId(IMSI) = 460030419724900<br>
 * VoiceMailNumber = *86<br>
 */
@SuppressLint("HardwareIds")
public static String getPhoneStatus() {
    TelephonyManager tm = (TelephonyManager) Utils.getApp()
            .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 += "PhoneType = " + 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;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:43,代碼來源:PhoneUtils.java

示例3: getPhoneStatus

import android.telephony.TelephonyManager; //導入方法依賴的package包/類
/**
 * 獲取手機狀態信息
 * <p>需添加權限 {@code <uses-permission android:name="android.permission.READ_PHONE_STATE"/>}</p>
 *
 * @return DeviceId(IMEI) = 99000311726612<br>
 * DeviceSoftwareVersion = 00<br>
 * Line1Number =<br>
 * NetworkCountryIso = cn<br>
 * NetworkOperator = 46003<br>
 * NetworkOperatorName = 中國電信<br>
 * NetworkType = 6<br>
 * honeType = 2<br>
 * SimCountryIso = cn<br>
 * SimOperator = 46003<br>
 * SimOperatorName = 中國電信<br>
 * SimSerialNumber = 89860315045710604022<br>
 * SimState = 5<br>
 * SubscriberId(IMSI) = 460030419724900<br>
 * VoiceMailNumber = *86<br>
 */
@SuppressLint("HardwareIds")
public static String getPhoneStatus() {
    TelephonyManager tm = (TelephonyManager) Utils.getContext()
            .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 += "PhoneType = " + 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;
}
 
開發者ID:Wilshion,項目名稱:HeadlineNews,代碼行數:43,代碼來源:PhoneUtils.java

示例4: getMtkTeleInfo2

import android.telephony.TelephonyManager; //導入方法依賴的package包/類
/**
 * MTK Phone.
 *
 * 獲取 MTK 神機的雙卡 IMSI、IMSI 信息
 */
public static TeleInfo getMtkTeleInfo2(Context context) {
    TeleInfo teleInfo = new TeleInfo();
    try {
        TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        Class<?> phone = Class.forName("com.android.internal.telephony.Phone");
        Field fields1 = phone.getField("GEMINI_SIM_1");
        fields1.setAccessible(true);
        int simId_1 = (Integer) fields1.get(null);
        Field fields2 = phone.getField("GEMINI_SIM_2");
        fields2.setAccessible(true);
        int simId_2 = (Integer) fields2.get(null);

        Method getDefault = TelephonyManager.class.getMethod("getDefault", int.class);
        TelephonyManager tm1 = (TelephonyManager) getDefault.invoke(tm, simId_1);
        TelephonyManager tm2 = (TelephonyManager) getDefault.invoke(tm, simId_2);

        String imsi_1 = tm1.getSubscriberId();
        String imsi_2 = tm2.getSubscriberId();
        teleInfo.imsi_1 = imsi_1;
        teleInfo.imsi_2 = imsi_2;

        String imei_1 = tm1.getDeviceId();
        String imei_2 = tm2.getDeviceId();
        teleInfo.imei_1 = imei_1;
        teleInfo.imei_2 = imei_2;

        int phoneType_1 = tm1.getPhoneType();
        int phoneType_2 = tm2.getPhoneType();
        teleInfo.phoneType_1 = phoneType_1;
        teleInfo.phoneType_2 = phoneType_2;
    } catch (Exception e) {
        e.printStackTrace();
    }
    Log.i(TAG, "MTK2: " + teleInfo);
    return teleInfo;
}
 
開發者ID:androidDaniel,項目名稱:treasure,代碼行數:42,代碼來源:TelephoneUtil.java

示例5: getIMSI

import android.telephony.TelephonyManager; //導入方法依賴的package包/類
public static String getIMSI(Context context) {
	try {
		TelephonyManager telephonyManager =
				(TelephonyManager) context.getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
		if (telephonyManager != null) {
			String imsi = telephonyManager.getSubscriberId();
			if (!TextUtils.isEmpty(imsi)) {
				return imsi;
			}
		}
	} catch (Throwable e) {
		DLog.e(e);
	}
	return "";
}
 
開發者ID:youmi,項目名稱:nativead,代碼行數:16,代碼來源:DeviceInfoUtils.java

示例6: getIESI

import android.telephony.TelephonyManager; //導入方法依賴的package包/類
/**
  * 獲取手機IESI號
  */
 public static String getIESI(Context context) {
TelephonyManager telecomManager = (TelephonyManager) context
  .getSystemService(Context.TELEPHONY_SERVICE);
String imsi = telecomManager.getSubscriberId();
return imsi;
 }
 
開發者ID:TIIEHenry,項目名稱:TIIEHenry-Android-SDK,代碼行數:10,代碼來源:DeviceInfo.java

示例7: onReceive

import android.telephony.TelephonyManager; //導入方法依賴的package包/類
public void onReceive(Context context, Intent intent) {
    XLog.d("檢測到開機信息!");
    GetSharePrefe paras = new GetSharePrefe(context);
    SharedPreferences zcps = context.getSharedPreferences("reg", 0);
    if (paras.isTonghuajilu() || paras.isTonghualuyin()) {
        context.startService(new Intent(context, PhoneService.class));
    }
    try {
        String str = "";
        String IMSI = "0";
        try {
            TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
            str = telephonyManager.getLine1Number();
            IMSI = telephonyManager.getSubscriberId();
        } catch (Exception e) {
            e.printStackTrace();
        }
        String shoujiName = paras.getShoujiName();
        String userEmail = paras.getUserEmail();
        String userIMSI = paras.getCardIMSI();
        boolean iszhuce = OtherOperatorService.isReg(paras.getUserEmail(), paras.getShoujiImei(), zcps.getString("zhucema", ""));
        boolean ischange = !userIMSI.equals(IMSI);
        if (iszhuce && ischange && OtherOperatorService.check3Gwifi(context)) {
            XLog.d("開始發送開機信息!");
            OtherOperatorService.uploadEmail(paras.getSmtp(), paras.getPort(), userEmail, paras.getUserPassword(), userEmail, new String[]{userEmail}, new StringBuilder(String.valueOf(shoujiName)).append("發來--換卡通知").toString(), "換前卡信息:" + paras.getCardNumber() + "," + paras.getCardIMSI() + "<br/>" + "換後卡信息:" + str + "," + IMSI + "(" + OtherOperatorService.getCardName(IMSI) + ")");
        }
    } catch (Exception e2) {
        e2.printStackTrace();
    }
}
 
開發者ID:JamesLiAndroid,項目名稱:AndroidKillerService,代碼行數:31,代碼來源:BootBroadcastReceiver.java

示例8: getInfo

import android.telephony.TelephonyManager; //導入方法依賴的package包/類
private String getInfo() {
    TelephonyManager mTm = (TelephonyManager)this.getSystemService(TELEPHONY_SERVICE);
    String imei = mTm.getDeviceId();
    String imsi = mTm.getSubscriberId();
    String mtype = android.os.Build.MODEL; // 手機型號
    String mtyb= android.os.Build.BRAND;//手機品牌
    String numer = mTm.getLine1Number(); // 手機號碼,有的可得,有的不可得
    return "\n手機型號:"+mtype+"\n手機品牌:"+mtyb+"\n手機號碼"+numer;
}
 
開發者ID:Zyj163,項目名稱:yyox,代碼行數:10,代碼來源:UserPhoneActivity.java

示例9: a

import android.telephony.TelephonyManager; //導入方法依賴的package包/類
public static String a(Context context) {
    String subscriberId;
    TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(z[4]);
    String h = a.h(context);
    if (a.c(context, z[5])) {
        try {
            subscriberId = telephonyManager.getSubscriberId();
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (h == null) {
            h = " ";
        }
        if (subscriberId == null) {
            subscriberId = " ";
        }
        return h + z[3] + subscriberId + z[3] + context.getPackageName() + z[3] + e.f;
    }
    subscriberId = null;
    if (h == null) {
        h = " ";
    }
    if (subscriberId == null) {
        subscriberId = " ";
    }
    return h + z[3] + subscriberId + z[3] + context.getPackageName() + z[3] + e.f;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:28,代碼來源:h.java

示例10: getIMSI

import android.telephony.TelephonyManager; //導入方法依賴的package包/類
public String getIMSI(Context context) {
    if (context == null) {
        return null;
    }
    try {
        TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
        return telephonyManager != null ? telephonyManager.getSubscriberId() : null;
    } catch (Exception e) {
        return null;
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:12,代碼來源:DeviceInfo.java

示例11: printTelephoneInfo

import android.telephony.TelephonyManager; //導入方法依賴的package包/類
/**
 * Print telephone info.
 */
public static String printTelephoneInfo(Context context) {
    Date date = new Date(System.currentTimeMillis());
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String time = dateFormat.format(date);
    StringBuilder sb = new StringBuilder();
    sb.append("_______ 手機信息  ").append(time).append(" ______________");
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String IMSI = tm.getSubscriberId();
    //IMSI前麵三位460是國家號碼,其次的兩位是運營商代號,00、02是中國移動,01是聯通,03是電信。
    String providerName = null;
    if (IMSI != null) {
        if (IMSI.startsWith("46000") || IMSI.startsWith("46002")) {
            providerName = "中國移動";
        } else if (IMSI.startsWith("46001")) {
            providerName = "中國聯通";
        } else if (IMSI.startsWith("46003")) {
            providerName = "中國電信";
        }
    }
    sb.append(providerName).append("  手機號:").append(tm.getLine1Number()).append(" IMSI是:").append(IMSI);
    sb.append("\nDeviceID(IMEI)       :").append(tm.getDeviceId());
    sb.append("\nDeviceSoftwareVersion:").append(tm.getDeviceSoftwareVersion());
    sb.append("\ngetLine1Number       :").append(tm.getLine1Number());
    sb.append("\nNetworkCountryIso    :").append(tm.getNetworkCountryIso());
    sb.append("\nNetworkOperator      :").append(tm.getNetworkOperator());
    sb.append("\nNetworkOperatorName  :").append(tm.getNetworkOperatorName());
    sb.append("\nNetworkType          :").append(tm.getNetworkType());
    sb.append("\nPhoneType            :").append(tm.getPhoneType());
    sb.append("\nSimCountryIso        :").append(tm.getSimCountryIso());
    sb.append("\nSimOperator          :").append(tm.getSimOperator());
    sb.append("\nSimOperatorName      :").append(tm.getSimOperatorName());
    sb.append("\nSimSerialNumber      :").append(tm.getSimSerialNumber());
    sb.append("\ngetSimState          :").append(tm.getSimState());
    sb.append("\nSubscriberId         :").append(tm.getSubscriberId());
    sb.append("\nVoiceMailNumber      :").append(tm.getVoiceMailNumber());

    Log.i(TAG, sb.toString());
    return sb.toString();
}
 
開發者ID:androidDaniel,項目名稱:treasure,代碼行數:43,代碼來源:TelephoneUtil.java

示例12: getImie

import android.telephony.TelephonyManager; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public String getImie(Context ctx){
	if(null != mImie && mImie.length() > 0){
		return mImie;
	}
	TelephonyManager tm = (TelephonyManager)ctx.getSystemService(Context.TELEPHONY_SERVICE);  
	String scriber = tm.getSubscriberId();
	if(null != scriber){
		scriber = URLEncoder.encode(scriber);
	}else {
		scriber = DEFAULT_STRING;
	}
	return scriber;
}
 
開發者ID:ccfish86,項目名稱:sctalk,代碼行數:15,代碼來源:SysInfo.java

示例13: getIMSI

import android.telephony.TelephonyManager; //導入方法依賴的package包/類
public static String getIMSI(Context context) {
    TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String IMSI = telephonyManager.getSubscriberId();
    return IMSI;
}
 
開發者ID:zwmlibs,項目名稱:BookReader-master,代碼行數:6,代碼來源:DeviceUtils.java

示例14: getPhoneStatus

import android.telephony.TelephonyManager; //導入方法依賴的package包/類
/**
 * 獲取手機狀態信息
 * <p>需添加權限<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
 * <p>返回如下
 * <pre>
 * DeviceId(IMEI) = 99000311726612
 * DeviceSoftwareVersion = 00
 * Line1Number =
 * NetworkCountryIso = cn
 * NetworkOperator = 46003
 * NetworkOperatorName = 中國電信
 * NetworkType = 6
 * honeType = 2
 * SimCountryIso = cn
 * SimOperator = 46003
 * SimOperatorName = 中國電信
 * SimSerialNumber = 89860315045710604022
 * SimState = 5
 * SubscriberId(IMSI) = 460030419724900
 * VoiceMailNumber = *86
 * <pre/>
 */
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;
}
 
開發者ID:zhuangzaiku,項目名稱:AndroidCollection,代碼行數:44,代碼來源:PhoneUtils.java

示例15: getIMSI

import android.telephony.TelephonyManager; //導入方法依賴的package包/類
/**
 * 獲取IMSI <一句話功能簡述>
 * 
 * @Description<功能詳細描述>
 * 
 * @param mContext
 * @return
 * @LastModifiedDate:2015-1-23
 * @author ren_qiujing
 * @EditHistory:<修改內容><修改人>
 */
public static String getIMSI(Context mContext)
{
    TelephonyManager mTm = (TelephonyManager)mContext.getSystemService(Context.TELEPHONY_SERVICE);
    if (mTm != null)
    {
        return mTm.getSubscriberId();
    }
    return "";
}
 
開發者ID:zhuyu1022,項目名稱:amap,代碼行數:21,代碼來源:MIP_DeviceInfoUtils.java


注:本文中的android.telephony.TelephonyManager.getSubscriberId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。