挂断电话

来源:互联网 发布:java程序员面试简历 编辑:程序博客网 时间:2024/04/30 13:26
            TelephonyManager tm = (TelephonyManager) getApplicationContext() .getSystemService(Service.TELEPHONY_SERVICE);
            try {
                Class<TelephonyManager> c = TelephonyManager.class;
                Method getITelephonyMethod = null;
                try {
                    getITelephonyMethod = c.getDeclaredMethod("getITelephony", (Class[]) null);
                    getITelephonyMethod.setAccessible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                try {
                    iTelephony = (ITelephony) getITelephonyMethod.invoke(tm,
                            (Object[]) null);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            } catch (Exception e1) {
                e1.printStackTrace();

            }

            try {
                 iTelephony.endCall();
            } catch (RemoteException e) {
                 e.printStackTrace();
            }

0 0
原创粉丝点击