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

哪里有.net电子商务网站开发教程网站开发的技术

哪里有.net电子商务网站开发教程,网站开发的技术,网页制作流程及详细步骤,上海优化公司排行榜一、功能简介 需求:开机自动开始搜网并显示网络列表 那么就不能将相关类做成单例,不能将subId、phoneId等卡相关的属性作为UI、服务的全局变量。 二、流程设计 NetworkSelectReceiver:监听开机广播,触发拉起搜网服务 NetworkOperatorService:搜网服务,完成后调起用户…

一、功能简介

需求:开机自动开始搜网并显示网络列表

那么就不能将相关类做成单例,不能将subId、phoneId等卡相关的属性作为UI、服务的全局变量。

二、流程设计

NetworkSelectReceiver:监听开机广播,触发拉起搜网服务

NetworkOperatorService:搜网服务,完成后调起用户界面

NetworkOperatorList:网络模式列表,显示搜网结果

三、开发代码

(一)NetworkSelectReceiver

接收器配置 AndroidManifest.xml

        <receiverandroid:name=".settings.network.NetworkSelectReceiver"android:exported="true"><intent-filter><action android:name="android.intent.action.BOOT_COMPLETED" /><action android:name="android.intent.action.SIM_STATE_CHANGED" /></intent-filter></receiver>

内部逻辑

onReceive => checkAndUpdateKeyWhenFirstBoot => getNetworkSelectionModeForPhone

public class NetworkSelectReceiver extends BroadcastReceiver {private Context mContext;private SubscriptionManager mSubscriptionManager;private static final int EVENT_GET_NETWORK_SELECTION_MODE_DONE = 300;private static final String DATA_PHONE_ID = "phone_id";private final static String TAG = "NetworkSelectReceiver ";//1、监听开机广播@Overridepublic void onReceive(Context context, Intent intent) {mcontext = context;if (TelephonyManager.getDefault().isMultiSimEnabled()) { //双卡设备mSubscriptionManager = (SubscriptionManager) context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);List<SubscriptionInfo> mSubscriptionInfoList = mSubscriptionManager.getActiveSubscriptionInfoList();int phoneCount = TelephonyManager.getDefault().getPhoneCount();if (mSubscriptionInfoList == null) {Log.d(TAG, "onReceive, no ActiveSubscriptionInfoList, phoneCount = " + phoneCount);return ;} else {Log.d(TAG, "onReceive, mSubscriptionInfoList = " + mSubscriptionInfoList + ", phoneCount = " + phoneCount);}//遍历并操作每一张卡。for (int i = 0; i < phoneCount; i++) {if (SubscriptionManager.isValidPhoneId(i)) {Log.d(TAG,"onReceive, isValidPhoneId = " + i);checkAndUpdateKeyWhenFirstBoot(context, i);}}} else {}//单卡逻辑}  //onReceive//2、场景校验(根据需求添加)private boolean checkAndUpdateKeyWhenFirstBoot(Context context, int phoneId) {Log.d(TAG,"checkAndUpdateKeyWhenFirstBoot, phoneId = " + phoneId);SharedPreferences prefs = ShowNetworkUtils.getSharedPreferences(context);String simKey = NetworkUtils.KEY_FIRST_BOOT + phoneId;//没有用到卡信息,此处用于debug,确认双卡是否正常TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);String mccmnc = "";if (tm == null) {return false;} else {mccmnc = tm.getSimOperatorNumericForPhone(phoneId);}int simState = tm.getSimState(phoneId);Log.d(TAG,"checkAndUpdateKeyWhenFirstBoot, simState = " + simState + ", mccmnc =" + mccmnc);//卡没加载好以及飞行模式下不发起搜网boolean isEnabled = (Settings.Glob
http://www.yayakq.cn/news/168329/

相关文章:

  • 全能医院网站管理系统通付盾 网站建设
  • 火锅自助餐网站建设建筑企业查询
  • 网站网页设计模板下载wordpress名站
  • 电子商务网站建设与管理课设沈阳三甲男科医院有哪些
  • 无锡本地模板网站建设app开发公司查询
  • 自助网站能在百度上搜到么网站建设先修课程
  • 保险代理做的比较好的网站数字媒体艺术就业方向
  • 网站建设服务器租用多少钱广告手机网站制作
  • 西安网站免费制作好看的网站颜色
  • 网站右下角广告展示代码网站做自动群发百度搜录
  • 淄博网站制作定制升级怎么提升网站的流量吗
  • 网站设计步骤牡丹江整站优化
  • 做视频有赚钱的网站有哪些安卓市场2021最新版下载
  • 南通专业做网站深圳宝安区今天的消息
  • 网站内容建设的原则是什么样的腾讯广告联盟官网
  • 福州高端网站建设做网站需要编程基础
  • 电子商务网站建设与管理期末考试试卷a十大互联网培训机构
  • 如何经营自己的网站微信商城和微网站建设
  • 阿里云主机如何安装wordpress整站seo公司
  • 市场上网站开发价格免费商城app
  • 网站扁平化结构和树形结构辽宁智能建站系统价格
  • 我想给企业做网站怎么做创建网站怎么创
  • 合肥建设管理学校网站首页html网页制作总结
  • 网络舆情处置流程图攀枝花网站seo
  • 做生意网站塘厦在哪里
  • 网站一直不被百度收录江门网站建设工作
  • 免费网站建站平台如何自己做微信小程序
  • 设计素材网站的问卷调查网络营销推广合作
  • 石家庄网站建设费用重庆医院门户网站建设
  • 做电影网站的工具周口市住房和城乡建设局网站