当前位置: 首页>>代码示例>>Java>>正文


Java TelephonyManager.getLine1Number方法代码示例

本文整理汇总了Java中android.telephony.TelephonyManager.getLine1Number方法的典型用法代码示例。如果您正苦于以下问题:Java TelephonyManager.getLine1Number方法的具体用法?Java TelephonyManager.getLine1Number怎么用?Java TelephonyManager.getLine1Number使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.telephony.TelephonyManager的用法示例。


在下文中一共展示了TelephonyManager.getLine1Number方法的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:hoangkien0705,项目名称:Android-UtilCode,代码行数:43,代码来源:PhoneUtils.java

示例4: 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(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 += "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:hushengjun,项目名称:FastAndroid,代码行数:43,代码来源:PhoneManager.java

示例5: 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

示例6: 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

示例7: getLine1Number

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
public static String getLine1Number(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    if (tm == null) {
        return "";
    }
    return "" + tm.getLine1Number();
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:8,代码来源:PhoneMessage.java

示例8: getPhoneNumber

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
 * 获取手机号码
 *
 * @return --返回手机号码
 */
private String getPhoneNumber(@NonNull Context context) {
    try {
        TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        return telephonyManager.getLine1Number();
    }catch (Exception e){
        return "";
    }
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:14,代码来源:PhoneManager.java

示例9: getSelfNumber

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
 * 获取本机号码
 */
public static String getSelfNumber(Context context) {
    try {
        TelephonyManager phoneMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        return phoneMgr.getLine1Number();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return "";
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:13,代码来源:CommonUtil.java

示例10: getPhoneNumber

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
@ReactMethod
public void getPhoneNumber(Promise promise){
  TelephonyManager manager = (TelephonyManager) this.reactContext.getSystemService(Context.TELEPHONY_SERVICE);
  String phoneNumber = manager.getLine1Number();
  WritableMap map = Arguments.createMap();
  map.putString("phoneNumber", phoneNumber);

  promise.resolve(map);
}
 
开发者ID:motius,项目名称:react-native-telephony-apis,代码行数:10,代码来源:RNReactNativeTelephonyModule.java

示例11: CommonParams

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
public CommonParams(Context context) {
    prefs = context.getSharedPreferences(Constants.PACKAGE_NAME, Context.MODE_PRIVATE);
    server = prefs.getString(Constants.PREF_SERVER_URL_FIELD, Constants.DEVELOPMENT_SERVER);
    uid = Settings.Secure.getString(context.getApplicationContext().getContentResolver(), Settings.Secure.ANDROID_ID);
    sdk = Integer.valueOf(Build.VERSION.SDK_INT).toString();
    version = Build.VERSION.RELEASE;

    TelephonyManager telephonyManager = ((TelephonyManager) context.getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE));
    provider = telephonyManager.getNetworkOperatorName();
    if (ContextCompat.checkSelfPermission(context, Manifest.permission.READ_SMS) == PackageManager.PERMISSION_GRANTED) {
        phone = telephonyManager.getLine1Number();
    }
    device = android.os.Build.MODEL;

}
 
开发者ID:adonespitogo,项目名称:AdoBot,代码行数:16,代码来源:CommonParams.java

示例12: getTelNumber

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
 * @param context 上下文
 * @return 返回手机号码 tel number
 */
@SuppressLint("MissingPermission")
public static String getTelNumber(Context context) {
    TelephonyManager tm = (TelephonyManager) context
            .getSystemService(Context.TELEPHONY_SERVICE);
    return tm.getLine1Number();
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:11,代码来源:RUtils.java

示例13: 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

示例14: getLine1Number

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
public String getLine1Number() {
    TelephonyManager telephonyManager = (TelephonyManager) getSystemService("phone");
    return telephonyManager == null ? "-1" : telephonyManager.getLine1Number();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:5,代码来源:DeviceHelper.java

示例15: getTelNumber

import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
 * 获取手机号码(双卡手机未测试)
 */
public static String getTelNumber(Context context) {
    TelephonyManager tm = (TelephonyManager) context
            .getSystemService(Context.TELEPHONY_SERVICE);
    return tm.getLine1Number();
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:9,代码来源:Network.java


注:本文中的android.telephony.TelephonyManager.getLine1Number方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。