It won't work,it will ask MODIFY_PHONE_STATE permission to block the calls.Now android is not allowing MODIFY_PHONE_STATE permissions to third party applications.
Exactly, did you find any solution for this?
Nope
Use TelecomManger to end call programatically for Android 9 and above using ANSWER_PHONE_CALL permission.
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P) { TelecomManager tm = (TelecomManager) getSystemService(Context.TELECOM_SERVICE); if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.ANSWER_PHONE_CALLS) == PackageManager.PERMISSION_GRANTED) { success = tm.endCall(); Log.d("call state", "call end"); } }
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It won't work,it will ask MODIFY_PHONE_STATE permission to block the calls.Now android is not allowing MODIFY_PHONE_STATE permissions to third party applications.
Exactly, did you find any solution for this?
Nope
Use TelecomManger to end call programatically for Android 9 and above using ANSWER_PHONE_CALL permission.
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P) {
TelecomManager tm = (TelecomManager) getSystemService(Context.TELECOM_SERVICE);
if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.ANSWER_PHONE_CALLS) == PackageManager.PERMISSION_GRANTED) {
success = tm.endCall();
Log.d("call state", "call end");
}
}