已弃用的 telecomManager.endCall() in android API 29 android.



在我使用以下代码结束调用之前

val telecomManager = context.getSystemService(Context.TELECOM_SERVICE) as TelecomManager
if (PermissionsUtil(context).checkPermissions()) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
telecomManager.endCall()
} else {
//telecomManager.isInCall
declinePhone(context)
}
}

但现在在 API 29 telecomManager.endCall(( 中显示已弃用。 我是否必须创建在后台运行的服务CallScreeningService或InCallService? 在没有直接方法的情况下,endCall(( 第三方应用程序如果不成为默认调用方应用程序就无法做到这一点。 如果是这样,那么我将如何获取呼叫详细信息以及如何保持我的服务在中文rom的后台运行

是的,您必须创建一个呼叫筛选服务,并且用户必须选择您的应用程序作为呼叫筛选服务的默认应用程序。

最新更新