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