当前位置: 首页 > news >正文

网站 网页区别手机免费建站app

网站 网页区别,手机免费建站app,wordpress em,网站建设产品编辑的工作内容业务场景 双卡设备进行网络等业务时,需要正确操作对应的卡。 执行卡业务和主要是使用subId和 PhoneId/SlotId进行区分隔离。 代码举例 初始化subId //初始化subId private int mSubId SubscriptionManager.INVALID_SUBSCRIPTION_ID;//1、通过intent传值&#x…

业务场景

双卡设备进行网络等业务时,需要正确操作对应的卡。

执行卡业务和主要是使用subId和 PhoneId/SlotId进行区分隔离。

代码举例

初始化subId

//初始化subId
private int mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;//1、通过intent传值(常用场景),默认为invaildId
int mSubId = intent.getIntExtra(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX,SubscriptionManager.INVALID_SUBSCRIPTION_ID);//2、根据注册信息subscriptionInfo
private SubscriptionInfo mSub; //接口传值初始化,认为已经非null
mSubId = mSub.getSubscriptionId();//3、通过Phone全局常量
mSubId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY, 0);//4、根据Phone对象
int mSubId = phone.getSubId();//5、根据卡槽获取
int mSubId = getSubId(soltId);

1、获取CarrierConfig 运营商配置

private PersistableBundle mCarrierConfig = null;
//通过subId获取CarrierConfig
CarrierConfigManager configManager = (CarrierConfigManager)getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE);
mCarrierConfig = configManager.getConfigForSubId(mSubid);

2、获取TelephonyManager

TelephonyManager tm = (TelephonyManager)getContext().getSystemService(Context.TELEPHONY_SERVICE);
tm = tm.createForSubscriptionId(mSubid);  //关键点,拿到对应subId的tm
String mImsi = tm.getSubscriberId(mSubid);  //imsi?not subid?

3、获取Phone 对象

if (mSubId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {int mPhoneId = SubscriptionManager.getPhoneId(mSubId); 
}

综合

private boolean setOperatorNetworkInfo(Context context, int slotId, int subId) {SubscriptionManager subscriptionManager = SubscriptionManager.from(context);TelephonyManager telephonyManager = TelephonyManager.from(context);//能直接调接口就不要调嵌套的啦,上面的TelephonyManager 初始化等同于下//TelephonyManager telephonyManager = context.getSystemService(Context.TELEPHONY_SERVICE);int mSubId = getSubId(soltId);if(soltId >= 0 && soltId < PHONE_COUNT){Phone phone = PhoneFactory.getPhone(soltId);SubscriptionInfo subInfo = subscriptionManager.getActiveSubscriptionInfo(subId);String mccmnc = telephonyManager.getSimOperator(subId);String imsi = telephonyManager.getSubscriberId(subId);}}//======== 相关源码类 SubscriptionManager & TelephonyManager =========/*** @deprecated developers should always obtain references directly from*             {@link Context#getSystemService(Class)}.*/@Deprecatedpublic static SubscriptionManager from(Context context) {return (SubscriptionManager) context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);}/** {@hide} */@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)public static TelephonyManager from(Context context) {return (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);}

其他相关说明

【笔记】Android Telephony | SIM 卡管理和subId、slotId、phoneId 定义关系说明-CSDN博客

http://www.hkea.cn/news/902197/

相关文章:

  • 网站底备案号链接代码西安网络推广营销公司
  • 哪个网站开发是按月付费的百度指数是免费的吗
  • asp网站后台管理教程放单平台
  • 做网站毕设任务书网络营销网站建设案例
  • .net 企业网站 模版关键词seo深圳
  • 网站建设优化价格网站seo诊断
  • 网站设计详细设计有没有好用的网站推荐
  • 没有货源可以开网店吗网站更新seo
  • 淄博有做网站的吗百度搜索排名怎么收费
  • wordpress页面添加自定义字段木卢seo教程
  • 长寿网站制作保定seo排名外包
  • 域名和网站一样吗电商运营推广怎么做
  • css个人简介网站怎么做b2b网站免费推广平台
  • 网站建设中企动力上海百度广告投诉电话客服24小时
  • 深圳靠谱的电商公司正版搜索引擎优化
  • 自己如何做团购网站腾讯云建站
  • 怀化招标网站磁力狗bt
  • 佛山网站建设服务公司培训机构查询网
  • 海尔集团电商网站建设考证培训机构
  • 动漫制作专业的高职实训室福州整站优化
  • 织梦商城网站模板免费下载怎么在网上做推广
  • asp做网站用什么写脚本温岭网络推广
  • 怎么建设外贸网站免费发seo外链平台
  • 郴州是几线城市武汉网站seo推广公司
  • 网站开发工程师求职信焊工培训内容
  • 铜陵公司做网站中国网站排名100
  • 我要建一个网站泰州百度公司代理商
  • php响应式网站模板vi设计公司
  • 随身wifi网站设置广告投放是做什么的
  • 中企动力做网站的优势网络销售平台有哪些软件