Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android如何保持和取消挂起活动电话_Android_Phone Call_Telephonymanager - Fatal编程技术网

Android如何保持和取消挂起活动电话

Android如何保持和取消挂起活动电话,android,phone-call,telephonymanager,Android,Phone Call,Telephonymanager,有人能告诉我如何保持和取消挂起活动电话吗? 我正在尝试使用ITelephony.aidl执行此操作,但无法保持通话。这是我试图保持通话状态的代码 TelephonyManager tm = (TelephonyManager) CallholdddActivity.this.getSystemService(Context.TELEPHONY_SERVICE); try{ Class<?> c = Class.forN

有人能告诉我如何保持和取消挂起活动电话吗? 我正在尝试使用ITelephony.aidl执行此操作,但无法保持通话。这是我试图保持通话状态的代码

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

使用ITelephony.aidl很难获得持有期权,因为没有这样的方法。 最好使用任何使用音频管理器的方法来查找调用是否处于活动状态。但缺点是音频管理器也可以被其他应用程序使用。因此,在了解模式时会遇到一个难题