您的位置:首页 > 大数据 > 人工智能

挂断电话

2016-06-21 20:27 417 查看

挂断电话

1.调用系统底层的api(aidl)
2.反射调用
3.拷贝两个aidl文件放到src目录
/PhoneGuard/src/android.telephony.NeighboringCellInfo.aidl
/PhoneGuard/src/com.android.internal.telephony.ITelephony.aidl
4.反射调用
private void endCall() {
// TODO Auto-generated method stub
//挂断电话
try {
Class type = Class.forName("android.os.ServiceManager");
Method getServiceMethod = type.getDeclaredMethod("getService", new Class[]{String.class});
IBinder binder = (IBinder) getServiceMethod.invoke(null, new Object[]{Context.TELEPHONY_SERVICE});
ITelephony telephony = ITelephony.Stub.asInterface(binder);
telephony.endCall();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
5.权限设置
android.permission.CALL_PHONE
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  aidl