1

I am using android studio and playing around with CsipSimple. I am trying to figure out the flow for an outgoing call.

There is a method called Place call, which triggers the intent that handles the action ACTION_CALL for the scheme 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();
}

Here is the declaration of activity in the manifest, that handles the 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>

I have put a debug point in the onCreate method of the activity OutgoingCallChooser. But it never comes there. Please help me. am i missing something obvious?

vumaasha
  • 2,765
  • 4
  • 27
  • 41

1 Answers1

0

You should override onNewIntent in your activity:

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

More information here: http://developer.android.com/guide/topics/manifest/activity-element.html#lmode

Eliahu Horwitz
  • 499
  • 3
  • 17
  • You wont get onCreate because of the android:launchMode="singleTask" flag in your manifest, just put a breakpoint in the onNewIntent, see if you get there. – Eliahu Horwitz Jan 24 '16 at 11:05
  • The thing is I have tried debug point in onNewIntent as well. it does not work. However Logcat works – vumaasha Jan 24 '16 at 11:06