当前位置: 首页>>代码示例>>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;未经允许,请勿转载。