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());
}