简体   繁体   中英

Android how to hold and unhold active phone call

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

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!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM