Capture large text from Notification Android

I use NotificationListenerServiceto listen to notifications.

When I receive a notification, I retrieve the header and message using the following code:

Bundle n = sbn.getNotification().extras;
String title = n.getString(Notification.EXTRAS_TITLE);
String message = n.getString(Notification.EXTRAS_TEXT);

The problem is getting notified using BigTextStyle.

How to get its value?

Thank.

+1
source share
1 answer

From what I see in the documentation, you can do:

Bundle n = sbn.getNotification().extras;
String title = n.getString(Notification.EXTRAS_TITLE);
String message = n.getString(Notification.EXTRAS_TEXT);
String bigText = n.getString(Notification.EXTRA_BIG_TEXT);

Link: https://developer.android.com/reference/android/app/Notification.html#EXTRA_BIG_TEXT

0
source

Source: https://habr.com/ru/post/1544608/


All Articles