我正在从我的Android应用程序打电话,它列出了一组应用程序,这些应用程序可以打电话,用户可以选择一个呼叫。但我想知道的是,是否有办法将调用重定向到特定的第三方VOIP应用程序(如思科贾贝尔),而不是列出所有能够打电话的应用程序。我试过用
为ACTION_NEW_OUT_GOING_CALLS注册使用广播接收器中断传出的呼叫,但我不知道如何重定向呼叫,下面是广播接收器的代码。
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);
}发布于 2012-10-08 06:24:52
我可以想出几种解决方案。
我不知道电话经理可以捕获有关VOIP电话的数据。我相信它的责任是专门针对电话本身的。我以前没有和电话经理合作过,所以我不知道。
https://stackoverflow.com/questions/12776217
复制相似问题