'How to Display a Pop-up Notification during an Incoming Call on Android

I want to show the name of a caller during an incoming call. For this, I'm creating a notification. The notification is delivered in the notifications with the name of the person. I want the notification to pop up and display the name. I've already tried setting IMPORTANCE_HIGH and PRIORITY_HIGH for the Notification channel and the notification respectively.

I'm using onScreenCall() method in CallScreeningService to trigger the notification.

I'm also open to other solutions by which I can show who is calling. I tried starting a new activity but that doesn't work when the app is closed. I'm however able to detect incoming calls despite my app being closed.

PS: I'm not replacing the default incoming call notification. I just want to show an additional notification with the name of the caller.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source