Reputation: 643
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);
}
Upvotes: 1
Views: 1892
Reputation: 11185
I can think of a couple of solutions.
Does the 3rd party provide APIs ? You could integrate with that (like the skype API)
If the 3rd party software has an activity that can accept your call, then you can forward the control to that activity by providing an appropriate intent.
I'm not aware that the telephony manager can capture data about VOIP calls. I believe its responsibility is specific to calls on the phone itself. I've not worked with the telephony manager before, so I would not know.
Upvotes: 1