ITelephony的使用

来源:互联网 发布:js车牌代表什么意思 编辑:程序博客网 时间:2024/05/17 22:50

1、在项目src中建立包:com.andorid.internal.telephony

2、该路径下,新建文件:ITelephony.aidl

3、在2中文件中写入如下内容:

        package com.android.internal.telephony; 

        

       interface ITelephony { 

      //此处写你要用的接口,如endcall....

       }

4、调用方法如下:


        try {


      Method getITelephonyMethod = TelephonyManager.class.getDeclaredMethod("getITelephony", (Class[]) null);


      getITelephonyMethod.setAccessible(true);


      iTelephony = (ITelephony) getITelephonyMethod.invoke(telephonyManager, (Object[]) null);


      iTelephony.(你要使用的接口,如endcall)
      
   


        } catch (Exception e) {


         e.printStackTrace();


         System.out.println(e.getMessage());


        }

0 0