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