1

I am making a call from my Android Application and it lists a set of apps that is capable of placing calls and user can select one to place calls. But what I want to know, Is there a way to redirect the call to a specific 3rd party VOIP App (like Cisco Jabber) instead of listing all apps** capable of placing calls. I have tried using

register for ACTION_NEW_OUT_GOING_CALLS using a broadcast receiver to interrupt the outgoing calls but I dont know how to redirect the call following is the code of broadcast receiver.

public void onReceive(Context context, Intent intent) {

    Bundle bundle = intent.getExtras();

    String phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);

    Log.d("Test", ""+phoneNumber);

    TelephonyManager telephoneManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

    try {
        Class<?> c = telephoneManager.getClass();
        Class className = Class.forName(c.getName());
        Log.d("Test", c.getSimpleName());
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }

    List<ResolveInfo> callAppList =  context.getPackageManager().queryIntentActivities(intent, 0);

    Log.d("Test", ""+callAppList.size());
    if(callAppList.size() > 0)
        Log.d("Test", callAppList.get(0).activityInfo.targetActivity);

}
4

1 回答 1

1

我可以想到几个解决方案。

  1. 第 3 方是否提供 API?您可以与之集成(例如Skype API)

  2. 如果第 3 方软件有一个可以接受您的呼叫的活动,那么您可以通过提供适当的意图将控制权转发给该活动。

我不知道电话管理器可以捕获有关 VOIP 呼叫的数据。我相信它的责任是特定于电话本身的呼叫。我以前没有和电话经理一起工作过,所以我不知道。

于 2012-10-08T06:24:52.367 回答