当前位置:操作系统 > 安卓/Android >>

android预置频道有时失败情况如何处理?

a.添加一个全局变量
private int retryNum = 5;
 
b. SmsReadyBroadcastReceiver的 onReceive方法里,多加一条trace,将simId打印出来,如下:
int extra = intent.getIntExtra("simId",0);
Log.e("kpp","extra="+extra);
 
c.handleSetStateResponse方法
如果发生exception则重试,在if (ar.exception != null)语句里添加实现体,如下:
 if (ar.exception != null) {
            if(retryNum > 0){
                                     
             Message msg;
             retryNum --;
             Log.e("kpp","retryNum="+retryNum);
             Log.e("kpp","simId="+simId);
              msg = mHandler.obtainMessage(MESSAGE_SET_STATE, simId, MESSAGE_SET_STATE,null);                                                                                               
   if (FeatureOption.MTK_GEMINI_SUPPORT == true)
   {
            ((GeminiPhone)phone).activateCellBroadcastSmsGemini(0,msg, simId);
   }
   else
   {
            phone.activateCellBroadcastSms(0,msg);
   }
   return;
   }
                            
else{
   if(DBG)
   Log.d(LOG_TAG, "handleSetStateResponse: ar.exception="+ ar.exception);
  }
 }
…….
补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,