本文整理汇总了Java中android.telephony.TelephonyManager.getNetworkOperatorName方法的典型用法代码示例。如果您正苦于以下问题:Java TelephonyManager.getNetworkOperatorName方法的具体用法?Java TelephonyManager.getNetworkOperatorName怎么用?Java TelephonyManager.getNetworkOperatorName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.telephony.TelephonyManager
的用法示例。
在下文中一共展示了TelephonyManager.getNetworkOperatorName方法的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;
}
示例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.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;
}
示例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(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;
}
示例4: getNetworkOperatorName
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
public static String getNetworkOperatorName(Context context) {
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
if (tm == null) {
return "";
}
return "" + tm.getNetworkOperatorName();
}
示例5: EnvironmentInfo
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
EnvironmentInfo(Context context, CachingObservable<LocationData> locationObservable, CachingObservable<Float> batteryInfoObservable) {
locationObservable.addObserver(this);
batteryInfoObservable.addObserver(this);
this.osName = "android";
this.device = Build.MODEL;
this.osVersion = Build.VERSION.RELEASE;
this.activityManager = (ActivityManager) context.getSystemService(Activity.ACTIVITY_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
this.deviceTotalMemory = Math.round((double) (getMemoryInfo(activityManager).totalMem) / (double) MEGA_BYTE);
} else {
this.deviceTotalMemory = -1L;
}
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
if (tm != null) {
this.country = tm.getSimCountryIso();
this.network = tm.getNetworkOperatorName();
}
if (this.country == null || "".equals(this.country)) {
this.country = Locale.getDefault().getCountry();
}
if (this.country != null) {
this.country = this.country.toUpperCase();
}
if (this.network == null || "".equals(this.network)) {
this.network = "wifi";
}
if (locationObservable.getCachedValue() != null) {
this.update(locationObservable, locationObservable.getCachedValue());
}
}
示例6: i
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
public static String i(Context context) {
try {
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
if (!a(context, "android.permission.READ_PHONE_STATE")) {
return "";
}
if (telephonyManager == null) {
return "";
}
return telephonyManager.getNetworkOperatorName();
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
示例7: h
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
public static String h(Context context) {
try {
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
if (telephonyManager == null) {
return "";
}
return telephonyManager.getNetworkOperatorName();
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
示例8: c
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
public String c() {
TelephonyManager telephonyManager = (TelephonyManager) hn.a().c().getSystemService("phone");
if (telephonyManager == null) {
return null;
}
return telephonyManager.getNetworkOperatorName();
}
示例9: getNetworkOperatorName
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
* 获取移动网络运营商名称
* <p>如中国联通、中国移动、中国电信
*/
public static String getNetworkOperatorName(Context context) {
TelephonyManager tm = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
return tm != null ? tm.getNetworkOperatorName() : null;
}
示例10: updateCarrierName
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
private void updateCarrierName() {
TelephonyManager telephonyManager = (TelephonyManager) context.getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
carrierName = telephonyManager.getNetworkOperatorName();
}
示例11: getNetworkOperatorName
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
* 获取网络运营商名称
* <p>中国移动、如中国联通、中国电信</p>
*
* @return 运营商名称
*/
public static String getNetworkOperatorName() {
TelephonyManager tm = (TelephonyManager) MyUtils.getContext().getSystemService(Context.TELEPHONY_SERVICE);
return tm != null ? tm.getNetworkOperatorName() : null;
}
示例12: getNetworkOperatorName
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
* 获取移动网络运营商名称
* <p>如中国联通、中国移动、中国电信</p>
*
* @param context 上下文
* @return 移动网络运营商名称
*/
public static String getNetworkOperatorName(Context context) {
TelephonyManager tm = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
return tm != null ? tm.getNetworkOperatorName() : null;
}
示例13: getNetworkOperatorName
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
* 获取网络运营商名称
* <p>中国移动、如中国联通、中国电信</p>
*
* @return 运营商名称
*/
public static String getNetworkOperatorName() {
TelephonyManager tm = (TelephonyManager) Utils.getContext().getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
return tm != null ? tm.getNetworkOperatorName() : null;
}
示例14: getNetworkOperatorName
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
* 获取网络运营商名称
* <p>中国移动、如中国联通、中国电信</p>
*
* @return 运营商名称
*/
public static String getNetworkOperatorName() {
TelephonyManager tm = (TelephonyManager) ToolCache.getContext().getSystemService(Context.TELEPHONY_SERVICE);
return tm != null ? tm.getNetworkOperatorName() : null;
}
示例15: getNetworkOperatorName
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
* 获取网络运营商名称
* <p>中国移动、如中国联通、中国电信</p>
*
* @return 运营商名称
*/
public static String getNetworkOperatorName() {
TelephonyManager tm = (TelephonyManager) Utils.getContext().getSystemService(Context.TELEPHONY_SERVICE);
return tm != null ? tm.getNetworkOperatorName() : null;
}