public static void endCall(Context paramContext) {
try {
if (Build.VERSION.SDK_INT >= 21) {
TelecomManager telecom = (TelecomManager) paramContext.getSystemService(Context.TELECOM_SERVICE);
if (ActivityCompat.checkSelfPermission(paramContext, Manifest.permission.ANSWER_PHONE_CALLS) != PackageManager.PERMISSION_GRANTED) {
return;
}
((TelecomManager) telecom).endCall();
}
TelephonyManager systemService = (TelephonyManager) paramContext.getSystemService(Context.TELEPHONY_SERVICE);
if (systemService == null)
return;
Method method = systemService.getClass().getDeclaredMethod("getITelephony", new Class[0]);
method.setAccessible(true);
Object invoke = method.invoke(paramContext, new Object[0]);
if (invoke == null)
android 挂断电话
最新推荐文章于 2021-11-19 17:11:33 发布