如何的Andr​​oid持有并取消保持活跃电话 [英] Android how to hold and unhold active phone call

查看:134
本文介绍了如何的Andr​​oid持有并取消保持活跃电话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以让我知道如何去把握和主动取消保持电话?
 我试图使用 ITelephony.aidl 来做到这一点,但无法保持通话。这里是code我试过握着主动呼叫

  TelephonyManager TM =(TelephonyManager)CallholdddActivity.this.getSystemService(Context.TELEPHONY_SERVICE);                尝试{
                类<> C =的Class.forName(tm.getClass()的getName());
                方法M = c.getDeclaredMethod(getITelephony);
                m.setAccessible(真);
                com.android.internal.telephony.ITelephony telephonyService =(ITelephony)m.invoke(商标);
                telephonyService =(ITelephony)m.invoke(商标);
                //telephonyService.silenceRinger();
                //这里我应该写什么,我不知道
                //System.out.println(a);
                }
                赶上(例外五){
                    // TODO:处理异常
                }
            }


解决方案

这是相当不可能达到与ITelephony.aidl控股选项,因为没有这样的方法。
这是更好地使用使用音频管理器中找到该呼叫是否处于活动状态的方法。但缺点有该音频管理器可以由其他应用程序使用的了。因此,会有一个两难在明知模式!

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

这篇关于如何的Andr​​oid持有并取消保持活跃电话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆