2016-01-24 48 views
1

我正在使用android studio並使用CsipSimple進行遊戲。我正試圖弄清楚一個去電的流程。無法調試以意向過濾器開始的活動

有一種方法叫地方調用,這將觸發一個處理方案CSIP

@Override 
public void placeCall(String number, Long accId) { 
    if(!TextUtils.isEmpty(number)) { 
     Intent it = new Intent(Intent.ACTION_CALL); 
     it.setData(SipUri.forgeSipUri(SipManager.PROTOCOL_CSIP, SipUri.getCanonicalSipContact(number, false))); 
     it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
     if(accId != null) { 
      it.putExtra(SipProfile.FIELD_ACC_ID, accId); 
     } 
     getActivity().startActivity(it); 
    } 
} 

@Override 
protected void onNewIntent(Intent intent) { 
    super.onNewIntent(intent); 
    resetInternals(); 
} 

下面是活動清單中的聲明行動ACTION_CALL意圖,處理action

<activity 
      android:name="com.freemobile.ui.outgoingcall.OutgoingCallChooser" 
      android:allowTaskReparenting="false" 
      android:configChanges="orientation" 
      android:excludeFromRecents="true" 
      android:label="@string/call" 
      android:launchMode="singleTask" 
      android:permission="android.permission.USE_FREEMOBILE_SIP" 
      android:process=":sipStack" 
      android:taskAffinity="" 
      android:theme="@style/DarkTheme.Dialog" > 
      <intent-filter> 
       <action android:name="android.intent.action.CALL" /> 

       <category android:name="android.intent.category.DEFAULT" /> 

       <data android:scheme="csip" /> 
       <data android:scheme="sip" /> 
       <data android:scheme="sips" /> 
      </intent-filter> 
      <intent-filter android:priority="10" > 
       <action android:name="android.phone.extra.NEW_CALL_INTENT" /> 

       <category android:name="android.intent.category.DEFAULT" /> 

       <data android:scheme="csip" /> 
       <data android:scheme="sip" /> 
       <data android:scheme="sips" /> 
      </intent-filter> 
     </activity> 

我已經將一個調試點放在活動OutgoingCallChooser的onCreate方法中。但它永遠不會到達那裏。請幫幫我。我錯過了一些明顯的東西?

回答

0

你應該在你的活動覆蓋onNewIntent:

@Override 
protected void onNewIntent(Intent intent) 
{ 
    super.onNewIntent(intent); 
    //Do something 
} 

點擊此處瞭解詳情: http://developer.android.com/guide/topics/manifest/activity-element.html#lmode

+0

它已經被覆蓋。 – vumaasha

+0

您不會因爲清單中的 android:launchMode =「singleTask」 標誌而在onCreate中,只需在onNewIntent中放置一個斷點,看看您是否到達那裏。 –

+0

事情是我已經嘗試了onNewIntent中的調試點。這是行不通的。但是,Logcat的作品 – vumaasha

相關問題