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);
  }
 }
…….

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。