androidtelegramandroid-connectionservicetelecom-manager

How does Telegram Android app is able to show notification of incoming call without POST_NOTIFICATIONS permission when app in the foreground?


So if I disable notifications for Telegram app then it's not able to notify a user about incoming calls when app is in the background/killed.

But if I open the Telegram app then it's able to receive incomings call notifications, firstly I thought it was custom UI displayed in the activity but not, it's also displayed in the system notification panel of Android.

How can it be achieved for my own video/voice call app?

Is it something related to ConnectionService and TelecomManager to achieve that and show notification without post notifications permission?


Solution

  • If your app configures itself to self-manage phone calls, you don't need the POST_NOTIFICATIONS permission in order for your app to send notifications that use the Notification.CallStyle notification style.

    https://developer.android.com/develop/ui/views/notifications/notification-permission#exemptions-self-manage-phone-calls

    See that link and the APIs it links to for how to configure an app that way.