开发者

how to start conference call programatically

I am creating an app depend on parent child relationship, in which when child got a call from a particular no, it shoul开发者_StackOverflow中文版d changed in a conference call with parent automatically. Is it possible?

I read about a class com.android.internal.telephony.gsm.GSMPhone

from which we can do this functionality. But I am not getting this class directly. So please help me to do this. I got the call from incoming call receiver.


You cannot do this from an application. com.android.internal.telephony.gsm.GSMPhone is an internal class and you cannot access it. You can try instantiate it by using JAVA reflection, but you will get exception. You can only set Phone state listener etc. from application or you can intercept the out going call by receiving some broadcast "NEW_OUTGOING_CALL". try Like this, but it will not work :-)

try {
            final Class<?> classPhonefactory = classLoader
                    .loadClass("com.android.internal.telephony.PhoneFactory");
            Class.forName("com.android.internal.telephony.PhoneFactory");

            // Object objPhonefactory = classPhonefactory.newInstance();



            Method method_getDefaultPhone;
            method_getDefaultPhone = classPhonefactory
                    .getDeclaredMethod("getGsmPhone");
            method_getDefaultPhone.setAccessible(true);
            Object phoneProxyInstance = method_getDefaultPhone.invoke(null, null);

            if (null == phoneProxyInstance) {
                Log.i("CALLActivity", "Exception!");
            } else {
                Log.i("CALLActivity", "GOT phoneProxyInstance!");
            }

        } catch (ClassNotFoundException e) {
            Log.e("CALLActivity", "PhoneFactory", e);
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜