I wanted a small feature: while you are on a normal phone call, and for a short while after it ends, offer a one-tap shortcut to open a chat with the person you are talking to. The obvious way to learn "who is on the line" is the call log or phone-state permissions. On Google Play those are tightly restricted, and asking for them makes an app look like it wants far more than it needs. This post is about the narrower route I used instead: a notification listener.
Disclosure: I'm the developer of QuickDial, the app this feature is part of, and this post is published from my account. It was written and published by an AI agent working on my behalf. QuickDial is an independent app, not affiliated with WhatsApp LLC or Meta.
Why not the call log
READ_CALL_LOG falls under Google Play's SMS and Call Log permissions policy. In practice it is meant for apps that are the default phone or assistant handler, and other uses need a declared, approved exception. Even where it is allowed, it gives you the whole call history, which is a lot of data for a feature that only needs the current caller.
What the system already shows
During a cellular call, the phone app posts an ongoing notification that shows the caller's name (for a saved contact) or number. A NotificationListenerService can see that notification, but only after the user grants Notification access in system settings. The user stays in control: the grant is explicit, visible in settings, and can be revoked at any time.
<service
android:name=".CallNotificationListener"
android:exported="true"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
</service>
Filter hard, read little
The listener receives every notification, so the first job is to ignore almost all of them:
override fun onNotificationPosted(sbn: StatusBarNotification) {
val n = sbn.notification
if (n.category != Notification.CATEGORY_CALL) return
if (sbn.packageName !in dialerPackages()) return
val title = n.extras.getCharSequence(Notification.EXTRA_TITLE)?.toString() ?: return
onActiveCaller(title) // a name or a number, nothing else
}
override fun onNotificationRemoved(sbn: StatusBarNotification) {
if (sbn.notification.category == Notification.CATEGORY_CALL) onCallEnded()
}
The rules I settled on:
- Only call-category notifications from the phone app. Messages, mail and everything else are dropped on the first line, unread.
- Only the visible title. That is the caller name or number the user can already see on screen. No message bodies, no notification history.
- Nothing leaves the device. The value is used to offer a shortcut and is not uploaded.
Turning a name into a number
If the title is a number, normalise it (strip formatting, add the right country code) and you are done. If it is a name, the caller is a saved contact, so look the name up in the phone's own contacts to get the number. Keep that match local.
Dialer apps differ between phone makers: the package name, whether the title is the name or "Ongoing call", and whether the number appears in the text instead. Expect to handle a few variants and to fail quietly (no shortcut) rather than guess.
The after-call window
Most follow-ups happen right after you hang up: "sending you the address now". So onCallEnded() does not remove the shortcut immediately. It keeps it for a period the user chooses in settings, then removes it. A fixed timer felt wrong, because how long people need varies a lot.
Explain the permission before asking
Notification access sounds scarier than it is, so the setup screen says exactly what is read (the active call's visible caller name or number) and why, before sending the user to the system settings page. If the service is off, the app shows a clear reminder of what it is needed for, rather than failing silently.
Where it lives
QuickDial uses notification access only for this: recognising an active cellular call's visible caller name or number, so it can offer the chat shortcut during the call and for a time you choose after it. The same app lets you message a number without saving it as a contact (any prefilled text is never sent for you) and puts a one-tap call button on an open personal chat. It works with WhatsApp and WhatsApp Business, and has no ads.
QuickDial is an independent app, not affiliated with WhatsApp LLC or Meta.
If you have dealt with odd dialer notification formats on a particular phone brand, I'd like to hear about them in the comments.
Top comments (0)