Article on Medium: https://medium.com/@merail/incoming-call-handler-0c57e8ae7188
This Android app demonstrates examples of usage:
BroadcastReceiverfor catching calls.CallScreeningServicefor cathing calls with Android 10+.- Creating a window from the
BroadcastReceiver/CallScreeningService. - Dragging the created window.
The following permissions are required to complete these steps:
android.permission.READ_PHONE_STATE.android.permission.READ_CONTACTS.android.permission.READ_CALL_LOG.android.permission.SYSTEM_ALERT_WINDOW.
Also for Android 10+, the application needs to install the ROLE_CALL_SCREENING role.
Note
Request Permissions Tool is used for handling permissions.
Handling of incoming calls will also work when the application is closed and after a device reboot.
Note: Android Marshmellow may have problems with handling due to security policy.