

If you are planning to use some DI library, like Hilt, you can inject this class into ‘M圜allScreeningService’.Ĭustom EventBus class is used for sending events (i.e. Method ‘displayToast’ is displaying simple Toast message, from ‘NotificationManager’ class.

With this properties and with original call details object, we are invoking ‘respondToCall’ method, which is responsible for all the hard work of handling incoming call. In this method we are checking if incoming phone call number is equal to the phone number that’s forbidden and in this case, we are rejecting the call, by applying the following properties to ‘CallResponse.Builder’: setRejectCall(true) setDisallowCall(true) setSkipCallLog(false) Method ‘handlePhoneCall’ handles the incoming phone call. Via ‘getPhoneNumber’ method we are getting formatted incoming phone number.

In ‘M圜allScreeningService’ we can see that we are overriding ‘onScreenCall’ method which contains informations about incoming phone call.
