Android how to hold and unhold active phone call

房东的猫 提交于 2019-12-13 00:57:39

问题


Can anybody let me know how to hold and unhold active phone call? I am trying to do it using ITelephony.aidl but unable to hold the call. Here is the code I tried to hold an active call

TelephonyManager tm = (TelephonyManager) CallholdddActivity.this.getSystemService(Context.TELEPHONY_SERVICE);

                try{
                Class<?> c = Class.forName(tm.getClass().getName());
                Method m = c.getDeclaredMethod("getITelephony");
                m.setAccessible(true);
                com.android.internal.telephony.ITelephony telephonyService = (ITelephony) m.invoke(tm);
                telephonyService = (ITelephony) m.invoke(tm);
                //telephonyService.silenceRinger();
                // here what should i write , i dont know 
                //System.out.println(a);
                }
                catch (Exception e) {
                    // TODO: handle exception
                }
            }

回答1:


It's quite not possible to attain the holding options with ITelephony.aidl, since there is no such method. It's better to use any methods using the Audio manager to find whether the call is active or not. But the drawback there is that Audio Manager could be used by other applications too. So, there will be a dilemma in knowing the Mode!!



来源:https://stackoverflow.com/questions/11846518/android-how-to-hold-and-unhold-active-phone-call

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!