: case TelephonyManager.NETWORK_TYPE_GPRS: case TelephonyManager.NETWORK_TYPE_CDMA...: case TelephonyManager.NETWORK_TYPE_EDGE: case TelephonyManager.NETWORK_TYPE...: case TelephonyManager.NETWORK_TYPE_UMTS: case TelephonyManager.NETWORK_TYPE_EVDO...: case TelephonyManager.NETWORK_TYPE_HSPA: case TelephonyManager.NETWORK_TYPE_EVDO_B...: case TelephonyManager.NETWORK_TYPE_EHRPD: case TelephonyManager.NETWORK_TYPE_HSPAP
telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager...= null) { telephonyManager.listen(customPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE...telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE...TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService...telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager
网络类型判断 TelephonyManager 中 定义常量值 public static final int NETWORK_TYPE_1xRTT = 7; public static final...case TelephonyManager.NETWORK_TYPE_GPRS: // unicom case TelephonyManager.NETWORK_TYPE_EDGE...case TelephonyManager.NETWORK_TYPE_EVDO_A: // telecom 3.5G case TelephonyManager.NETWORK_TYPE_EVDO_B...case TelephonyManager.NETWORK_TYPE_HSPAP: // unicom case TelephonyManager.NETWORK_TYPE_HSDPA...case TelephonyManager.NETWORK_TYPE_UMTS: // unicom return NETWORK_TYPE_3G;
//手机号码 public static String getLine1Number(Context context) { TelephonyManager tm = (TelephonyManager...public static String getNetworkOperator(Context context) { TelephonyManager tm = (TelephonyManager...case TelephonyManager.NETWORK_TYPE_EVDO_A: case TelephonyManager.NETWORK_TYPE_HSDPA...case TelephonyManager.NETWORK_TYPE_HSPA: case TelephonyManager.NETWORK_TYPE_EVDO_B...case TelephonyManager.NETWORK_TYPE_GPRS: case TelephonyManager.NETWORK_TYPE_EDGE
: // 联通2g case TelephonyManager.NETWORK_TYPE_CDMA: // 电信2g case TelephonyManager.NETWORK_TYPE_EDGE...: // 移动2g case TelephonyManager.NETWORK_TYPE_1xRTT: case TelephonyManager.NETWORK_TYPE_IDEN:...case TelephonyManager.NETWORK_TYPE_UMTS: case TelephonyManager.NETWORK_TYPE_EVDO_0: case...TelephonyManager.NETWORK_TYPE_HSDPA: case TelephonyManager.NETWORK_TYPE_HSUPA: case TelephonyManager.NETWORK_TYPE_HSPA...: case TelephonyManager.NETWORK_TYPE_EVDO_B: // case TelephonyManager.NETWORK_TYPE_EHRPD:
: case TelephonyManager.NETWORK_TYPE_CDMA: case TelephonyManager.NETWORK_TYPE_EDGE...: case TelephonyManager.NETWORK_TYPE_1xRTT: case TelephonyManager.NETWORK_TYPE_IDEN...case TelephonyManager.NETWORK_TYPE_UMTS: case TelephonyManager.NETWORK_TYPE_EVDO...: case TelephonyManager.NETWORK_TYPE_HSPA: case TelephonyManager.NETWORK_TYPE_EVDO_B...: case TelephonyManager.NETWORK_TYPE_EHRPD: case TelephonyManager.NETWORK_TYPE_HSPAP
但是网上最常见的方法有坑,也就是TelephonyManager.getDeviceId(),这方法有可能获取的是MEID或者空值。...telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String...telephonyManager = (TelephonyManager) this .getSystemService(TELEPHONY_SERVICE);// 取得相关系统服务...String simOperatorName = telephonyManager.getSimOperatorName(); String imei = telephonyManager.getDeviceId...tel = telephonyManager.getLine1Number(); //取出 MSISDN,很可能为空 String imsi = telephonyManager.getSubscriberId
: private static boolean isFastMobileNetwork(Context context) { TelephonyManager telephonyManager = (...TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); switch (telephonyManager.getNetworkType...case TelephonyManager.NETWORK_TYPE_CDMA: return false; // ~ 14-64 kbps case TelephonyManager.NETWORK_TYPE_EDGE...case TelephonyManager.NETWORK_TYPE_HSUPA: return true; // ~ 1-23 Mbps case TelephonyManager.NETWORK_TYPE_UMTS...TelephonyManager.NETWORK_TYPE_LTE: return true; // ~ 10+ Mbps case TelephonyManager.NETWORK_TYPE_UNKNOWN
class */ import java.lang.reflect.Method; import android.content.Context; import android.telephony.TelephonyManager...telephonyManager = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE));...telephonyInfo.imeiSIM1 = telephonyManager.getDeviceId();; telephonyInfo.imeiSIM2 = null;...telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); try{...telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); try{
: case TelephonyManager.NETWORK_TYPE_EDGE: case TelephonyManager.NETWORK_TYPE_CDMA...: case TelephonyManager.NETWORK_TYPE_1xRTT: case TelephonyManager.NETWORK_TYPE_IDEN...: case TelephonyManager.NETWORK_TYPE_EVDO_0: case TelephonyManager.NETWORK_TYPE_EVDO_A...: case TelephonyManager.NETWORK_TYPE_HSDPA: case TelephonyManager.NETWORK_TYPE_HSUPA...: case TelephonyManager.NETWORK_TYPE_HSPA: case TelephonyManager.NETWORK_TYPE_EVDO_B
对象,通过getSystemService(TELEPHONY_SERVICE) 调用TelephonyManager对象的getSimSerialNumber()方法,得到String类型的序列号 把序列号保存在...; import android.content.Intent; import android.content.SharedPreferences; import android.telephony.TelephonyManager...import android.content.SharedPreferences.Editor; import android.os.Bundle; import android.telephony.TelephonyManager...telephonyManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate...= (TelephonyManager) getSystemService(TELEPHONY_SERVICE); // 根据保存的数据设置状态 String sim
telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);...telephonyManager.isNetworkRoaming()) { netType = 4; } else if (nSubType =...= TelephonyManager.NETWORK_TYPE_UMTS || nSubType == TelephonyManager.NETWORK_TYPE_HSDPA...|| nSubType == TelephonyManager.NETWORK_TYPE_EVDO_0 && !...|| nSubType == TelephonyManager.NETWORK_TYPE_EDGE || nSubType == TelephonyManager.NETWORK_TYPE_CDMA
允许程序读写手机状态和身份 --> 代码如下 //实例化TelephonyManager...对象 TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE...); Method method = telephonyManager.getClass().getMethod("getDeviceId", int.class); //获取IMEI号 String...; String imei2 = (String) method.invoke(manager, 1); //获取MEID号 String meid = (String) method.invoke(telephonyManager
Android N 以上版本判断移动网络类型 先获取存储电话机本身服务信息的对象: TelephonyManager telephonyManager = (TelephonyManager) ctx.getSystemService...telephonyManager = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE); if (...: case TelephonyManager.NETWORK_TYPE_EDGE: case TelephonyManager.NETWORK_TYPE_CDMA...: case TelephonyManager.NETWORK_TYPE_1xRTT: case TelephonyManager.NETWORK_TYPE_IDEN...case TelephonyManager.NETWORK_TYPE_EVDO_B: case TelephonyManager.NETWORK_TYPE_HSPA:
空闲状态,TelephonyManager.CALL_STATE_RINGING响铃状态, TelephonyManager.CALL_STATE_OFFHOOK通话状态 需要权限android.permission.READ_PHONE_STATE...public void onCreate() { super.onCreate(); System.out.println("服务创建"); TelephonyManager...tm=(TelephonyManager) getSystemService(TELEPHONY_SERVICE); tm.listen(new MyPhoneStateListener...: System.out.println("空闲状态"); break; case TelephonyManager.CALL_STATE_RINGING...: System.out.println("响铃状态"); break; case TelephonyManager.CALL_STATE_OFFHOOK
getITelephonyMethod = TelephonyManager.class.getDeclaredMethod("getITelephony", (Class[]) null); ... mTelephonyMgr = (TelephonyManager) this .getSystemService(Context.TELEPHONY_SERVICE...Mostly this is used by the * TelephonyManager class. ... * Please clean them up if possible and use TelephonyManager insteadl.... * Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE * and TelephonyManager.PHONE_TYPE_GSM
; getNumber(); } private void getNumber() { TelephonyManager tm = (TelephonyManager) this.getSystemService...这个函数时报了错就是单卡手机(这是我自己的经验,不一定全正确) method = TelephonyManager.class.getMethod("getSimStateGemini", new...// 遍历 TelephonyManager 里的方法 public void printTelephonyManagerMethodNamesForThisDevice() { TelephonyManager...telephony = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); Class<?...telephony = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); Class<?
中实例化ITelephony,并返回 */ static public ITelephony getITelephony(TelephonyManager telMgr) throws Exception...Mostly this is used by the * TelephonyManager class. A few places are still using this directly....* Please clean them up if possible and use TelephonyManager instead....()) { case TelephonyManager.CALL_STATE_OFFHOOK:// 电话打进来接通状态;电话打出时首先监听到的状态。...Log.i("onCallStateChanged", "CALL_STATE_OFFHOOK"); break; case TelephonyManager.CALL_STATE_RINGING:
领取专属 10元无门槛券
手把手带您无忧上云