How to Block Incomi...
Clear all

How to Block Incoming Call in Android P (API 28)

Joined: 2 years ago
Posts: 1
Topic starter  

I am developing an android app to block the incoming calls. Till API 27 (OREO MR1), I have used the reflection method (iTelephony) to block the incoming calls. But in Android Pie, reflections are deprecated. So the iTelephony method is not working in Android P version. Is there any working method to block incoming call in API >= 28.

Member Admin
Joined: 7 years ago
Posts: 71

In Android Pie, there is an official way to block the incoming calls using endcall() function in TelecomManager,

To use this function you need ANSWER_PHONE_CALLS permission. This is categorized as dangerous permission, so you need to request this permission during runtime instead of adding in manifest file.

if (checkSelfPermission(Manifest.permission.ANSWER_PHONE_CALLS) == PackageManager.PERMISSION_GRANTED) {
TelecomManager tcm = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
if (tcm != null) {
try {
if (incomingCallNumber != null) {
Log.d(TAG, "Incoming Call Blocked " + incomingCallNumber);
} catch (Exception e) {

EDIT: endcall() function is deprecated in Android Q (API 29), so you can use this method only in Android Pie (API 28).

This post was modified 2 years ago by admin


Leave a reply

Author Name

Author Email

Title *

Preview 0 Revisions Saved