1

我正在使用 android studio 并使用 CsipSimple。我试图弄清楚拨出电话的流程。

有一个叫做 Place call 的方法,它触发了为方案 csip 处理动作 ACTION_CALL 的意图

@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();
}

这是清单中的活动声明,用于处理操作

<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 方法中放置了一个调试点。但它永远不会出现。请帮我。我错过了一些明显的东西吗?

4

1 回答 1

0

您应该在活动中覆盖 onNewIntent:

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

更多信息在这里:http: //developer.android.com/guide/topics/manifest/activity-element.html#lmode

于 2016-01-24T10:56:05.857 回答