How to get sub title data from notification?

70 Views Asked by At

My app listening notification data from extends NotificationListenerService. I would like to get the call duration of a Whatsapp call

enter image description here

I tried with Notification.EXTRA_SUB_TEXT and Notification.EXTRA_CHRONOMETER_COUNT_DOWN but nothing work.

public static String getSubText(Notification notification) {
    Bundle extras = NotificationCompat.getExtras(notification);
    String text;
    CharSequence charSequence = extras.getCharSequence(Notification.EXTRA_SUB_TEXT);
    if (charSequence != null) {
        text = charSequence.toString();
    } else {
        text = String.valueOf(extras.get(Notification.EXTRA_SUB_TEXT));
    }
    return text;
}
0

There are 0 best solutions below